From 0d14f932b02c43dd83fa3dfbe25d92755a4d7e26 Mon Sep 17 00:00:00 2001
From: Jens-Heiner Rechtien
Date: Mon, 18 Sep 2000 15:33:13 +0000
Subject: initial import
---
goodies/inc/agapidll.hxx | 111 +
goodies/inc/agsdkdll.hxx | 184 ++
goodies/inc/b3dtex.hxx | 385 ++++
goodies/inc/b3dtrans.hxx | 371 +++
goodies/inc/b3dvolum.hxx | 119 +
goodies/inc/chagent.hxx | 234 ++
goodies/inc/chanapi.hxx | 117 +
goodies/inc/channel.hxx | 148 ++
goodies/inc/chlist.hxx | 266 +++
goodies/inc/chresid.hxx | 75 +
goodies/inc/chtuner.hxx | 131 ++
goodies/inc/crypt.hxx | 93 +
goodies/inc/goodies.hrc | 91 +
goodies/inc/grfmgr.hxx | 453 ++++
goodies/inc/mailenum.hxx | 129 ++
goodies/inc/vector3d.hxx | 146 ++
goodies/prj/d.lst | 116 +
goodies/source/base3d/b3dcolor.cxx | 364 +++
goodies/source/base3d/b3dcommn.cxx | 1415 ++++++++++++
goodies/source/base3d/b3dcommn.hxx | 165 ++
goodies/source/base3d/b3dcompo.cxx | 1180 ++++++++++
goodies/source/base3d/b3ddeflt.cxx | 1786 +++++++++++++++
goodies/source/base3d/b3ddeflt.hxx | 233 ++
goodies/source/base3d/b3dentty.cxx | 366 +++
goodies/source/base3d/b3dgeom.cxx | 982 ++++++++
goodies/source/base3d/b3dlight.cxx | 870 ++++++++
goodies/source/base3d/b3dopngl.cxx | 1502 +++++++++++++
goodies/source/base3d/b3dopngl.hxx | 223 ++
goodies/source/base3d/b3dtex.cxx | 1176 ++++++++++
goodies/source/base3d/b3dtrans.cxx | 936 ++++++++
goodies/source/base3d/base3d.cxx | 1268 +++++++++++
goodies/source/base3d/makefile.mk | 124 ++
goodies/source/base3d/matril3d.cxx | 191 ++
goodies/source/filter.vcl/egif/dlgegif.cxx | 137 ++
goodies/source/filter.vcl/egif/dlgegif.hrc | 70 +
goodies/source/filter.vcl/egif/dlgegif.hxx | 101 +
goodies/source/filter.vcl/egif/dlgegif.src | 230 ++
goodies/source/filter.vcl/egif/egif.cxx | 653 ++++++
goodies/source/filter.vcl/egif/egifstr.src | 73 +
goodies/source/filter.vcl/egif/giflzwc.cxx | 287 +++
goodies/source/filter.vcl/egif/giflzwc.hxx | 99 +
goodies/source/filter.vcl/egif/makefile.mk | 188 ++
goodies/source/filter.vcl/egif/strings.hrc | 62 +
goodies/source/filter.vcl/eos2met/dlgeos2.cxx | 259 +++
goodies/source/filter.vcl/eos2met/dlgeos2.hrc | 75 +
goodies/source/filter.vcl/eos2met/dlgeos2.hxx | 111 +
goodies/source/filter.vcl/eos2met/dlgeos2.src | 318 +++
goodies/source/filter.vcl/eos2met/eos2met.cxx | 2667 ++++++++++++++++++++++
goodies/source/filter.vcl/eos2met/eos2mstr.src | 77 +
goodies/source/filter.vcl/eos2met/makefile.mk | 180 ++
goodies/source/filter.vcl/eos2met/strings.hrc | 64 +
goodies/source/filter.vcl/epbm/dlgepbm.cxx | 126 ++
goodies/source/filter.vcl/epbm/dlgepbm.hrc | 68 +
goodies/source/filter.vcl/epbm/dlgepbm.hxx | 101 +
goodies/source/filter.vcl/epbm/dlgepbm.src | 198 ++
goodies/source/filter.vcl/epbm/epbm.cxx | 319 +++
goodies/source/filter.vcl/epbm/epbmstr.src | 69 +
goodies/source/filter.vcl/epbm/makefile.mk | 184 ++
goodies/source/filter.vcl/epbm/strings.hrc | 61 +
goodies/source/filter.vcl/epgm/dlgepgm.cxx | 123 +
goodies/source/filter.vcl/epgm/dlgepgm.hrc | 68 +
goodies/source/filter.vcl/epgm/dlgepgm.hxx | 101 +
goodies/source/filter.vcl/epgm/dlgepgm.src | 198 ++
goodies/source/filter.vcl/epgm/epgm.cxx | 339 +++
goodies/source/filter.vcl/epgm/epgmstr.src | 69 +
goodies/source/filter.vcl/epgm/makefile.mk | 185 ++
goodies/source/filter.vcl/epgm/strings.hrc | 61 +
goodies/source/filter.vcl/epict/dlgepct.cxx | 222 ++
goodies/source/filter.vcl/epict/dlgepct.hrc | 75 +
goodies/source/filter.vcl/epict/dlgepct.hxx | 111 +
goodies/source/filter.vcl/epict/dlgepct.src | 317 +++
goodies/source/filter.vcl/epict/epict.cxx | 2313 +++++++++++++++++++
goodies/source/filter.vcl/epict/epictstr.src | 77 +
goodies/source/filter.vcl/epict/makefile.mk | 186 ++
goodies/source/filter.vcl/epict/strings.hrc | 64 +
goodies/source/filter.vcl/eppm/dlgeppm.cxx | 125 ++
goodies/source/filter.vcl/eppm/dlgeppm.hrc | 68 +
goodies/source/filter.vcl/eppm/dlgeppm.hxx | 101 +
goodies/source/filter.vcl/eppm/dlgeppm.src | 198 ++
goodies/source/filter.vcl/eppm/eppm.cxx | 347 +++
goodies/source/filter.vcl/eppm/eppmstr.src | 69 +
goodies/source/filter.vcl/eppm/makefile.mk | 183 ++
goodies/source/filter.vcl/eppm/strings.hrc | 61 +
goodies/source/filter.vcl/eps/dlgeps.cxx | 221 ++
goodies/source/filter.vcl/eps/dlgeps.hrc | 77 +
goodies/source/filter.vcl/eps/dlgeps.hxx | 111 +
goodies/source/filter.vcl/eps/dlgeps.src | 459 ++++
goodies/source/filter.vcl/eps/eps.cxx | 2411 ++++++++++++++++++++
goodies/source/filter.vcl/eps/epsstr.src | 188 ++
goodies/source/filter.vcl/eps/makefile.mk | 181 ++
goodies/source/filter.vcl/eps/strings.hrc | 66 +
goodies/source/filter.vcl/eras/eras.cxx | 345 +++
goodies/source/filter.vcl/eras/makefile.mk | 169 ++
goodies/source/filter.vcl/etiff/etiff.cxx | 663 ++++++
goodies/source/filter.vcl/etiff/makefile.mk | 169 ++
goodies/source/filter.vcl/expm/expm.cxx | 331 +++
goodies/source/filter.vcl/expm/makefile.mk | 169 ++
goodies/source/filter.vcl/icgm/actimpr.cxx | 1324 +++++++++++
goodies/source/filter.vcl/icgm/bitmap.cxx | 449 ++++
goodies/source/filter.vcl/icgm/bitmap.hxx | 121 +
goodies/source/filter.vcl/icgm/bundles.cxx | 319 +++
goodies/source/filter.vcl/icgm/bundles.hxx | 207 ++
goodies/source/filter.vcl/icgm/cgm.cxx | 1065 +++++++++
goodies/source/filter.vcl/icgm/cgm.hxx | 226 ++
goodies/source/filter.vcl/icgm/cgmres.hrc | 62 +
goodies/source/filter.vcl/icgm/cgmtypes.hxx | 179 ++
goodies/source/filter.vcl/icgm/chart.cxx | 148 ++
goodies/source/filter.vcl/icgm/chart.hxx | 250 +++
goodies/source/filter.vcl/icgm/class0.cxx | 169 ++
goodies/source/filter.vcl/icgm/class1.cxx | 309 +++
goodies/source/filter.vcl/icgm/class2.cxx | 258 +++
goodies/source/filter.vcl/icgm/class3.cxx | 179 ++
goodies/source/filter.vcl/icgm/class4.cxx | 1005 +++++++++
goodies/source/filter.vcl/icgm/class5.cxx | 569 +++++
goodies/source/filter.vcl/icgm/class7.cxx | 269 +++
goodies/source/filter.vcl/icgm/classx.cxx | 322 +++
goodies/source/filter.vcl/icgm/elements.cxx | 436 ++++
goodies/source/filter.vcl/icgm/elements.hxx | 179 ++
goodies/source/filter.vcl/icgm/main.hxx | 97 +
goodies/source/filter.vcl/icgm/makefile.mk | 266 +++
goodies/source/filter.vcl/icgm/outact.cxx | 238 ++
goodies/source/filter.vcl/icgm/outact.hxx | 208 ++
goodies/source/filter.vcl/idxf/dxf2mtf.cxx | 804 +++++++
goodies/source/filter.vcl/idxf/dxf2mtf.hxx | 163 ++
goodies/source/filter.vcl/idxf/dxfblkrd.cxx | 167 ++
goodies/source/filter.vcl/idxf/dxfblkrd.hxx | 123 +
goodies/source/filter.vcl/idxf/dxfentrd.cxx | 575 +++++
goodies/source/filter.vcl/idxf/dxfentrd.hxx | 498 +++++
goodies/source/filter.vcl/idxf/dxfgrprd.cxx | 388 ++++
goodies/source/filter.vcl/idxf/dxfgrprd.hxx | 200 ++
goodies/source/filter.vcl/idxf/dxfreprd.cxx | 383 ++++
goodies/source/filter.vcl/idxf/dxfreprd.hxx | 166 ++
goodies/source/filter.vcl/idxf/dxftblrd.cxx | 387 ++++
goodies/source/filter.vcl/idxf/dxftblrd.hxx | 223 ++
goodies/source/filter.vcl/idxf/dxfvec.cxx | 258 +++
goodies/source/filter.vcl/idxf/dxfvec.hxx | 261 +++
goodies/source/filter.vcl/idxf/idxf.cxx | 119 +
goodies/source/filter.vcl/idxf/makefile.mk | 176 ++
goodies/source/filter.vcl/ieps/ieps.cxx | 527 +++++
goodies/source/filter.vcl/ieps/makefile.mk | 168 ++
goodies/source/filter.vcl/ios2met/ios2met.cxx | 2847 ++++++++++++++++++++++++
goodies/source/filter.vcl/ios2met/makefile.mk | 175 ++
goodies/source/filter.vcl/ipbm/ipbm.cxx | 606 +++++
goodies/source/filter.vcl/ipbm/makefile.mk | 168 ++
goodies/source/filter.vcl/ipcd/ipcd.cxx | 509 +++++
goodies/source/filter.vcl/ipcd/makefile.mk | 182 ++
goodies/source/filter.vcl/ipcx/ipcx.cxx | 483 ++++
goodies/source/filter.vcl/ipcx/makefile.mk | 170 ++
goodies/source/filter.vcl/ipict/ipict.cxx | 2021 +++++++++++++++++
goodies/source/filter.vcl/ipict/makefile.mk | 172 ++
goodies/source/filter.vcl/ipsd/ipsd.cxx | 748 +++++++
goodies/source/filter.vcl/ipsd/makefile.mk | 168 ++
goodies/source/filter.vcl/iras/iras.cxx | 439 ++++
goodies/source/filter.vcl/iras/makefile.mk | 168 ++
goodies/source/filter.vcl/itga/itga.cxx | 810 +++++++
goodies/source/filter.vcl/itga/makefile.mk | 168 ++
goodies/source/filter.vcl/itiff/ccidecom.cxx | 1143 ++++++++++
goodies/source/filter.vcl/itiff/ccidecom.hxx | 159 ++
goodies/source/filter.vcl/itiff/itiff.cxx | 1340 +++++++++++
goodies/source/filter.vcl/itiff/lzwdecom.cxx | 224 ++
goodies/source/filter.vcl/itiff/lzwdecom.hxx | 113 +
goodies/source/filter.vcl/itiff/makefile.mk | 171 ++
goodies/source/graphic/grfattr.cxx | 148 ++
goodies/source/graphic/grfcache.cxx | 876 ++++++++
goodies/source/graphic/grfcache.hxx | 133 ++
goodies/source/graphic/grfmgr.cxx | 851 +++++++
goodies/source/graphic/grfmgr2.cxx | 1492 +++++++++++++
goodies/source/graphic/makefile.mk | 95 +
goodies/source/inv/expl.cxx | 165 ++
goodies/source/inv/expl.hxx | 110 +
goodies/source/inv/gegner.src | 194 ++
goodies/source/inv/invader.cxx | 637 ++++++
goodies/source/inv/invader.hrc | 94 +
goodies/source/inv/invader.hxx | 173 ++
goodies/source/inv/invader1.cxx | 476 ++++
goodies/source/inv/makefile.mk | 213 ++
goodies/source/inv/monst.cxx | 436 ++++
goodies/source/inv/monst.hxx | 172 ++
goodies/source/inv/score.cxx | 198 ++
goodies/source/inv/score.hxx | 94 +
goodies/source/inv/shapes.cxx | 497 +++++
goodies/source/inv/shapes.hxx | 229 ++
goodies/source/inv/strings.hrc | 88 +
goodies/source/inv/strings.src | 167 ++
goodies/source/inv/waves.hxx | 152 ++
goodies/util/makefile.mk | 133 ++
goodies/util/shelp.ico | Bin 0 -> 6750 bytes
187 files changed, 69195 insertions(+)
create mode 100644 goodies/inc/agapidll.hxx
create mode 100644 goodies/inc/agsdkdll.hxx
create mode 100644 goodies/inc/b3dtex.hxx
create mode 100644 goodies/inc/b3dtrans.hxx
create mode 100644 goodies/inc/b3dvolum.hxx
create mode 100644 goodies/inc/chagent.hxx
create mode 100644 goodies/inc/chanapi.hxx
create mode 100644 goodies/inc/channel.hxx
create mode 100644 goodies/inc/chlist.hxx
create mode 100644 goodies/inc/chresid.hxx
create mode 100644 goodies/inc/chtuner.hxx
create mode 100644 goodies/inc/crypt.hxx
create mode 100644 goodies/inc/goodies.hrc
create mode 100644 goodies/inc/grfmgr.hxx
create mode 100644 goodies/inc/mailenum.hxx
create mode 100644 goodies/inc/vector3d.hxx
create mode 100644 goodies/prj/d.lst
create mode 100644 goodies/source/base3d/b3dcolor.cxx
create mode 100644 goodies/source/base3d/b3dcommn.cxx
create mode 100644 goodies/source/base3d/b3dcommn.hxx
create mode 100644 goodies/source/base3d/b3dcompo.cxx
create mode 100644 goodies/source/base3d/b3ddeflt.cxx
create mode 100644 goodies/source/base3d/b3ddeflt.hxx
create mode 100644 goodies/source/base3d/b3dentty.cxx
create mode 100644 goodies/source/base3d/b3dgeom.cxx
create mode 100644 goodies/source/base3d/b3dlight.cxx
create mode 100644 goodies/source/base3d/b3dopngl.cxx
create mode 100644 goodies/source/base3d/b3dopngl.hxx
create mode 100644 goodies/source/base3d/b3dtex.cxx
create mode 100644 goodies/source/base3d/b3dtrans.cxx
create mode 100644 goodies/source/base3d/base3d.cxx
create mode 100644 goodies/source/base3d/makefile.mk
create mode 100644 goodies/source/base3d/matril3d.cxx
create mode 100644 goodies/source/filter.vcl/egif/dlgegif.cxx
create mode 100644 goodies/source/filter.vcl/egif/dlgegif.hrc
create mode 100644 goodies/source/filter.vcl/egif/dlgegif.hxx
create mode 100644 goodies/source/filter.vcl/egif/dlgegif.src
create mode 100644 goodies/source/filter.vcl/egif/egif.cxx
create mode 100644 goodies/source/filter.vcl/egif/egifstr.src
create mode 100644 goodies/source/filter.vcl/egif/giflzwc.cxx
create mode 100644 goodies/source/filter.vcl/egif/giflzwc.hxx
create mode 100644 goodies/source/filter.vcl/egif/makefile.mk
create mode 100644 goodies/source/filter.vcl/egif/strings.hrc
create mode 100644 goodies/source/filter.vcl/eos2met/dlgeos2.cxx
create mode 100644 goodies/source/filter.vcl/eos2met/dlgeos2.hrc
create mode 100644 goodies/source/filter.vcl/eos2met/dlgeos2.hxx
create mode 100644 goodies/source/filter.vcl/eos2met/dlgeos2.src
create mode 100644 goodies/source/filter.vcl/eos2met/eos2met.cxx
create mode 100644 goodies/source/filter.vcl/eos2met/eos2mstr.src
create mode 100644 goodies/source/filter.vcl/eos2met/makefile.mk
create mode 100644 goodies/source/filter.vcl/eos2met/strings.hrc
create mode 100644 goodies/source/filter.vcl/epbm/dlgepbm.cxx
create mode 100644 goodies/source/filter.vcl/epbm/dlgepbm.hrc
create mode 100644 goodies/source/filter.vcl/epbm/dlgepbm.hxx
create mode 100644 goodies/source/filter.vcl/epbm/dlgepbm.src
create mode 100644 goodies/source/filter.vcl/epbm/epbm.cxx
create mode 100644 goodies/source/filter.vcl/epbm/epbmstr.src
create mode 100644 goodies/source/filter.vcl/epbm/makefile.mk
create mode 100644 goodies/source/filter.vcl/epbm/strings.hrc
create mode 100644 goodies/source/filter.vcl/epgm/dlgepgm.cxx
create mode 100644 goodies/source/filter.vcl/epgm/dlgepgm.hrc
create mode 100644 goodies/source/filter.vcl/epgm/dlgepgm.hxx
create mode 100644 goodies/source/filter.vcl/epgm/dlgepgm.src
create mode 100644 goodies/source/filter.vcl/epgm/epgm.cxx
create mode 100644 goodies/source/filter.vcl/epgm/epgmstr.src
create mode 100644 goodies/source/filter.vcl/epgm/makefile.mk
create mode 100644 goodies/source/filter.vcl/epgm/strings.hrc
create mode 100644 goodies/source/filter.vcl/epict/dlgepct.cxx
create mode 100644 goodies/source/filter.vcl/epict/dlgepct.hrc
create mode 100644 goodies/source/filter.vcl/epict/dlgepct.hxx
create mode 100644 goodies/source/filter.vcl/epict/dlgepct.src
create mode 100644 goodies/source/filter.vcl/epict/epict.cxx
create mode 100644 goodies/source/filter.vcl/epict/epictstr.src
create mode 100644 goodies/source/filter.vcl/epict/makefile.mk
create mode 100644 goodies/source/filter.vcl/epict/strings.hrc
create mode 100644 goodies/source/filter.vcl/eppm/dlgeppm.cxx
create mode 100644 goodies/source/filter.vcl/eppm/dlgeppm.hrc
create mode 100644 goodies/source/filter.vcl/eppm/dlgeppm.hxx
create mode 100644 goodies/source/filter.vcl/eppm/dlgeppm.src
create mode 100644 goodies/source/filter.vcl/eppm/eppm.cxx
create mode 100644 goodies/source/filter.vcl/eppm/eppmstr.src
create mode 100644 goodies/source/filter.vcl/eppm/makefile.mk
create mode 100644 goodies/source/filter.vcl/eppm/strings.hrc
create mode 100644 goodies/source/filter.vcl/eps/dlgeps.cxx
create mode 100644 goodies/source/filter.vcl/eps/dlgeps.hrc
create mode 100644 goodies/source/filter.vcl/eps/dlgeps.hxx
create mode 100644 goodies/source/filter.vcl/eps/dlgeps.src
create mode 100644 goodies/source/filter.vcl/eps/eps.cxx
create mode 100644 goodies/source/filter.vcl/eps/epsstr.src
create mode 100644 goodies/source/filter.vcl/eps/makefile.mk
create mode 100644 goodies/source/filter.vcl/eps/strings.hrc
create mode 100644 goodies/source/filter.vcl/eras/eras.cxx
create mode 100644 goodies/source/filter.vcl/eras/makefile.mk
create mode 100644 goodies/source/filter.vcl/etiff/etiff.cxx
create mode 100644 goodies/source/filter.vcl/etiff/makefile.mk
create mode 100644 goodies/source/filter.vcl/expm/expm.cxx
create mode 100644 goodies/source/filter.vcl/expm/makefile.mk
create mode 100644 goodies/source/filter.vcl/icgm/actimpr.cxx
create mode 100644 goodies/source/filter.vcl/icgm/bitmap.cxx
create mode 100644 goodies/source/filter.vcl/icgm/bitmap.hxx
create mode 100644 goodies/source/filter.vcl/icgm/bundles.cxx
create mode 100644 goodies/source/filter.vcl/icgm/bundles.hxx
create mode 100644 goodies/source/filter.vcl/icgm/cgm.cxx
create mode 100644 goodies/source/filter.vcl/icgm/cgm.hxx
create mode 100644 goodies/source/filter.vcl/icgm/cgmres.hrc
create mode 100644 goodies/source/filter.vcl/icgm/cgmtypes.hxx
create mode 100644 goodies/source/filter.vcl/icgm/chart.cxx
create mode 100644 goodies/source/filter.vcl/icgm/chart.hxx
create mode 100644 goodies/source/filter.vcl/icgm/class0.cxx
create mode 100644 goodies/source/filter.vcl/icgm/class1.cxx
create mode 100644 goodies/source/filter.vcl/icgm/class2.cxx
create mode 100644 goodies/source/filter.vcl/icgm/class3.cxx
create mode 100644 goodies/source/filter.vcl/icgm/class4.cxx
create mode 100644 goodies/source/filter.vcl/icgm/class5.cxx
create mode 100644 goodies/source/filter.vcl/icgm/class7.cxx
create mode 100644 goodies/source/filter.vcl/icgm/classx.cxx
create mode 100644 goodies/source/filter.vcl/icgm/elements.cxx
create mode 100644 goodies/source/filter.vcl/icgm/elements.hxx
create mode 100644 goodies/source/filter.vcl/icgm/main.hxx
create mode 100644 goodies/source/filter.vcl/icgm/makefile.mk
create mode 100644 goodies/source/filter.vcl/icgm/outact.cxx
create mode 100644 goodies/source/filter.vcl/icgm/outact.hxx
create mode 100644 goodies/source/filter.vcl/idxf/dxf2mtf.cxx
create mode 100644 goodies/source/filter.vcl/idxf/dxf2mtf.hxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfblkrd.cxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfblkrd.hxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfentrd.cxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfentrd.hxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfgrprd.cxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfgrprd.hxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfreprd.cxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfreprd.hxx
create mode 100644 goodies/source/filter.vcl/idxf/dxftblrd.cxx
create mode 100644 goodies/source/filter.vcl/idxf/dxftblrd.hxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfvec.cxx
create mode 100644 goodies/source/filter.vcl/idxf/dxfvec.hxx
create mode 100644 goodies/source/filter.vcl/idxf/idxf.cxx
create mode 100644 goodies/source/filter.vcl/idxf/makefile.mk
create mode 100644 goodies/source/filter.vcl/ieps/ieps.cxx
create mode 100644 goodies/source/filter.vcl/ieps/makefile.mk
create mode 100644 goodies/source/filter.vcl/ios2met/ios2met.cxx
create mode 100644 goodies/source/filter.vcl/ios2met/makefile.mk
create mode 100644 goodies/source/filter.vcl/ipbm/ipbm.cxx
create mode 100644 goodies/source/filter.vcl/ipbm/makefile.mk
create mode 100644 goodies/source/filter.vcl/ipcd/ipcd.cxx
create mode 100644 goodies/source/filter.vcl/ipcd/makefile.mk
create mode 100644 goodies/source/filter.vcl/ipcx/ipcx.cxx
create mode 100644 goodies/source/filter.vcl/ipcx/makefile.mk
create mode 100644 goodies/source/filter.vcl/ipict/ipict.cxx
create mode 100644 goodies/source/filter.vcl/ipict/makefile.mk
create mode 100644 goodies/source/filter.vcl/ipsd/ipsd.cxx
create mode 100644 goodies/source/filter.vcl/ipsd/makefile.mk
create mode 100644 goodies/source/filter.vcl/iras/iras.cxx
create mode 100644 goodies/source/filter.vcl/iras/makefile.mk
create mode 100644 goodies/source/filter.vcl/itga/itga.cxx
create mode 100644 goodies/source/filter.vcl/itga/makefile.mk
create mode 100644 goodies/source/filter.vcl/itiff/ccidecom.cxx
create mode 100644 goodies/source/filter.vcl/itiff/ccidecom.hxx
create mode 100644 goodies/source/filter.vcl/itiff/itiff.cxx
create mode 100644 goodies/source/filter.vcl/itiff/lzwdecom.cxx
create mode 100644 goodies/source/filter.vcl/itiff/lzwdecom.hxx
create mode 100644 goodies/source/filter.vcl/itiff/makefile.mk
create mode 100644 goodies/source/graphic/grfattr.cxx
create mode 100644 goodies/source/graphic/grfcache.cxx
create mode 100644 goodies/source/graphic/grfcache.hxx
create mode 100644 goodies/source/graphic/grfmgr.cxx
create mode 100644 goodies/source/graphic/grfmgr2.cxx
create mode 100644 goodies/source/graphic/makefile.mk
create mode 100644 goodies/source/inv/expl.cxx
create mode 100644 goodies/source/inv/expl.hxx
create mode 100644 goodies/source/inv/gegner.src
create mode 100644 goodies/source/inv/invader.cxx
create mode 100644 goodies/source/inv/invader.hrc
create mode 100644 goodies/source/inv/invader.hxx
create mode 100644 goodies/source/inv/invader1.cxx
create mode 100644 goodies/source/inv/makefile.mk
create mode 100644 goodies/source/inv/monst.cxx
create mode 100644 goodies/source/inv/monst.hxx
create mode 100644 goodies/source/inv/score.cxx
create mode 100644 goodies/source/inv/score.hxx
create mode 100644 goodies/source/inv/shapes.cxx
create mode 100644 goodies/source/inv/shapes.hxx
create mode 100644 goodies/source/inv/strings.hrc
create mode 100644 goodies/source/inv/strings.src
create mode 100644 goodies/source/inv/waves.hxx
create mode 100644 goodies/util/makefile.mk
create mode 100644 goodies/util/shelp.ico
diff --git a/goodies/inc/agapidll.hxx b/goodies/inc/agapidll.hxx
new file mode 100644
index 000000000000..5be1d87ac46e
--- /dev/null
+++ b/goodies/inc/agapidll.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: agapidll.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _AGAPIDLL_HXX
+#define _AGAPIDLL_HXX
+
+#include "tools/agapi.hxx"
+#include "agsdkdll.hxx"
+
+class ChannelList;
+class ChannelAgentItem;
+class INetURLObject;
+class Library;
+
+class AgentApiDll : public AgentApi
+{
+ Library* pAgentDll;
+ ChannelApiFncs aChannelApiFncs;
+
+ FncInitAgent fncInitAgent;
+ FncShutDownAgent fncShutDownAgent;
+ FncNewDataPermission fncNewDataPermission;
+ FncNewData fncNewData;
+ FncNotifyChannelObjFile fncNotifyChannelObjFile;
+ FncNotifyChannelObjData fncNotifyChannelObjData;
+ FncRegisterChannels fncRegisterChannels;
+ FncRegisterUpdateTransmitter fncRegisterUpdateTransmitter;
+
+protected:
+ friend class ChannelList;
+ virtual BOOL StartAgent();
+
+public:
+ AgentApiDll(ChannelAgentItem* pAgent);
+ ~AgentApiDll();
+
+ virtual void InitAgent();
+ virtual void ShutDownAgent();
+
+ virtual BOOL NewDataPermission(const String& rChannelName);
+ virtual void NewData(const String& rChannelName, const INetURLObject& rURL);
+
+ virtual void NotifyChannelObjFile(const INetURLObject& rURL,
+ const String& rFileName);
+ virtual void NotifyChannelObjData(const INetURLObject& rURL,
+ void* pBuffer, long nOffset, long nLen, long nTotalLen);
+
+ virtual void RegisterChannels();
+ virtual void RegisterUpdateTransmitter();
+};
+
+#endif //_AGAPIDLL_HXX
+
diff --git a/goodies/inc/agsdkdll.hxx b/goodies/inc/agsdkdll.hxx
new file mode 100644
index 000000000000..d2f0f2b86526
--- /dev/null
+++ b/goodies/inc/agsdkdll.hxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * $RCSfile: agsdkdll.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _AGSDKDLL_HXX
+#define _AGSDKDLL_HXX
+
+#ifndef _SV_CALL
+#if defined(WIN) || defined(WNT) || ( defined(OS2) && !defined( ICC ))
+#define _SV_CALL _cdecl
+#elif defined( ICC ) && defined( OS2 )
+#define _SV_CALL __cdecl
+#else
+#define _SV_CALL
+#endif
+#endif
+
+#define AGSDKDLL_VERSION 2
+
+typedef void* AgentInst;
+
+////////////////////////////////////////////////////////////////////////////////
+// Channel API Functions
+//
+
+enum AgentStreamType {
+ AS_LOCAL_FILE = 1,
+ AS_MEMORY = 2
+};
+
+typedef void (_SV_CALL *FncChShutDownAgent)(AgentInst pAg);
+
+typedef void (_SV_CALL *FncChSetLastSuccUpd)(AgentInst pAg);
+
+typedef void (_SV_CALL *FncChGetChannelObj)(AgentInst pAg, const char* pURL,
+ AgentStreamType eStreamType, const char* pFileName);
+
+typedef void (_SV_CALL *FncChAddChannelItem)(AgentInst pAg, const char* pName,
+ const char* pTransmitter, const char* pChannel, unsigned short nUpdPeriode,
+ const char* pAgentName );
+
+typedef void (_SV_CALL *FncChDelChannelItem)(AgentInst pAg, const char* pChName);
+
+typedef void (_SV_CALL *FncChSetTransmitter)(AgentInst pAg, const char* pChName,
+ const char* pURL);
+
+typedef void (_SV_CALL *FncChSetChannel)(AgentInst pAg, const char* pChName,
+ const char* pRelURL);
+
+typedef void (_SV_CALL *FncChSetChannelName)(AgentInst pAg, const char* pChName,
+ const char* pNewChName);
+
+typedef void (_SV_CALL *FncChSetUpdPeriode)(AgentInst pAg, const char* pChName,
+ unsigned short nUpdPeriode);
+
+typedef void (_SV_CALL *FncChSetChannelAgentName)(AgentInst pAg, const char* pChName,
+ const char* pAgName);
+
+typedef void (_SV_CALL *FncChSetUpdateTransmitter)(AgentInst pAg,
+ const char* pTransmitter);
+
+typedef const char* (_SV_CALL *FncChGetAgentSourceURL)(AgentInst pAg);
+
+struct ChannelApiFncs
+{
+ unsigned short nVersion;
+ FncChShutDownAgent fncShutDownAgent;
+ FncChSetLastSuccUpd fncSetLastSuccUpd;
+ FncChGetChannelObj fncGetChannelObj;
+ FncChAddChannelItem fncAddChannelItem;
+ FncChDelChannelItem fncDelChannelItem;
+ FncChSetTransmitter fncSetTransmitter;
+ FncChSetChannel fncSetChannel;
+ FncChSetChannelName fncSetChannelName;
+ FncChSetUpdPeriode fncSetUpdPeriode;
+ FncChSetChannelAgentName fncSetChannelAgentName;
+ FncChSetUpdateTransmitter fncSetUpdateTransmitter;
+ FncChGetAgentSourceURL fncGetAgentSourceURL;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// Agent API Functions
+//
+
+#if defined(WIN) || defined(WNT) || defined(OS2) || defined(UNX) || defined(MAC)
+extern "C" {
+#endif
+
+typedef void (_SV_CALL *FncInitAgent)(AgentInst, ChannelApiFncs*);
+void _SV_CALL InitAgent(AgentInst, ChannelApiFncs*);
+
+typedef void (_SV_CALL *FncShutDownAgent)();
+void _SV_CALL ShutDownAgent();
+
+// NewDataPermission
+// ChannelName
+typedef unsigned char (_SV_CALL *FncNewDataPermission)(const char*);
+unsigned char _SV_CALL NewDataPermission(const char*);
+
+// NewData
+// ChannelName, URL
+typedef void (_SV_CALL *FncNewData)(const char*, const char*);
+void _SV_CALL NewData(const char*, const char*);
+
+// NotifyChannelObjFile
+// URL, abs. Filename
+typedef void (_SV_CALL *FncNotifyChannelObjFile)(const char*, const char*);
+void _SV_CALL NotifyChannelObjFile(const char*, const char*);
+
+// NotifyChannelObjData
+// URL, Buffer, Offset, Len, TotalLen
+typedef void (_SV_CALL *FncNotifyChannelObjData)(const char*, void*, long, long, long);
+void _SV_CALL NotifyChannelObjData(const char*, void*, long, long, long);
+
+typedef void (_SV_CALL *FncRegisterChannels)(AgentInst, ChannelApiFncs*);
+void _SV_CALL RegisterChannels(AgentInst, ChannelApiFncs*);
+
+typedef void (_SV_CALL *FncRegisterUpdateTransmitter)(AgentInst, ChannelApiFncs*);
+void _SV_CALL RegisterUpdateTransmitter(AgentInst, ChannelApiFncs*);
+
+#if defined(WIN) || defined(WNT) || defined(OS2) || defined(UNX) || defined(MAC)
+}
+#endif
+
+#endif //_AGSDKDLL_HXX
+
+
diff --git a/goodies/inc/b3dtex.hxx b/goodies/inc/b3dtex.hxx
new file mode 100644
index 000000000000..3aeecdb85de1
--- /dev/null
+++ b/goodies/inc/b3dtex.hxx
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dtex.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DTEX_HXX
+#define _B3D_B3DTEX_HXX
+
+#ifndef _SV_OPENGL_HXX
+#include
+#endif
+
+#ifndef _SV_BITMAP_HXX
+#include
+#endif
+
+#ifndef _SV_COLOR_HXX
+#include
+#endif
+
+#ifndef _SV_SALBTYPE_HXX
+#include
+#endif
+
+// Vorausdeklarationen
+class BitmapReadAccess;
+class BitmapColor;
+
+/*************************************************************************
+|*
+|* define fuer die Ueberlebensdauer einer Textur
+|*
+\************************************************************************/
+
+#define B3D_TEXTURE_LIFETIME (200)
+
+/*************************************************************************
+|*
+|* Long-Zeiger fuer OpenGL Texturdatenuebergabe
+|*
+\************************************************************************/
+
+#ifdef WIN
+typedef UINT8 huge* GL_UINT8;
+#else
+typedef UINT8* GL_UINT8;
+#endif
+
+/*************************************************************************
+|*
+|* Art der Pixeldaten der Textur
+|*
+\************************************************************************/
+
+enum Base3DTextureKind
+{
+ Base3DTextureLuminance = 1,
+ Base3DTextureIntensity,
+ Base3DTextureColor
+};
+
+/*************************************************************************
+|*
+|* Modus der Textur
+|*
+\************************************************************************/
+
+enum Base3DTextureMode
+{
+ Base3DTextureReplace = 1,
+ Base3DTextureModulate,
+ Base3DTextureBlend
+};
+
+/*************************************************************************
+|*
+|* Filtermodus der Textur
+|*
+\************************************************************************/
+
+enum Base3DTextureFilter
+{
+ Base3DTextureNearest = 1,
+ Base3DTextureLinear
+};
+
+/*************************************************************************
+|*
+|* Wrapping-Modus
+|*
+\************************************************************************/
+
+enum Base3DTextureWrap
+{
+ Base3DTextureClamp = 1,
+ Base3DTextureRepeat,
+ Base3DTextureSingle
+};
+
+/*************************************************************************
+|*
+|* Defines fuer Maskenbildung um Entscheidung innerhalb von ModifyColor
+|* zu beschleunigen
+|*
+\************************************************************************/
+
+#define B3D_TXT_KIND_LUM 0x00
+#define B3D_TXT_KIND_INT 0x01
+#define B3D_TXT_KIND_COL 0x02
+
+#define B3D_TXT_MODE_REP 0x04
+#define B3D_TXT_MODE_MOD 0x08
+#define B3D_TXT_MODE_BND 0x0C
+
+#define B3D_TXT_FLTR_NEA 0x10
+
+/*************************************************************************
+|*
+|* Klassen fuer TexturAttribute beim Anfordern von Texturen
+|*
+\************************************************************************/
+
+#define TEXTURE_ATTRIBUTE_TYPE_BITMAP 0x0000
+#define TEXTURE_ATTRIBUTE_TYPE_GRADIENT 0x0001
+#define TEXTURE_ATTRIBUTE_TYPE_HATCH 0x0002
+
+class TextureAttributes
+{
+private:
+public:
+ TextureAttributes();
+
+ virtual BOOL operator==(const TextureAttributes&) const =0;
+ virtual UINT16 GetTextureAttributeType() const =0;
+};
+
+class TextureAttributesBitmap : public TextureAttributes
+{
+private:
+ Bitmap aBitmapAttribute;
+
+public:
+ TextureAttributesBitmap(Bitmap aBmp);
+
+ virtual BOOL operator==(const TextureAttributes&) const;
+ virtual UINT16 GetTextureAttributeType() const;
+
+ Bitmap GetBitmapAttribute() { return aBitmapAttribute; }
+};
+
+class TextureAttributesGradient : public TextureAttributes
+{
+private:
+ void* pFill;
+ void* pStepCount;
+
+public:
+ TextureAttributesGradient(void* pF, void *pSC);
+
+ virtual BOOL operator==(const TextureAttributes&) const;
+ virtual UINT16 GetTextureAttributeType() const;
+
+ void* GetFillAttribute() { return pFill; }
+ void* GetStepCountAttribute() { return pStepCount; }
+};
+
+class TextureAttributesHatch : public TextureAttributes
+{
+private:
+ void* pFill;
+
+public:
+ TextureAttributesHatch(void* pF);
+
+ virtual BOOL operator==(const TextureAttributes&) const;
+ virtual UINT16 GetTextureAttributeType() const;
+
+ void* GetHatchFillAttribute() { return pFill; }
+};
+
+/*************************************************************************
+|*
+|* Klasse fuer Texturen in Base3D
+|*
+\************************************************************************/
+
+class B3dTexture
+{
+protected:
+ // Die Bitmap der Textur
+ Bitmap aBitmap;
+ BitmapReadAccess* pReadAccess;
+
+ // Attribute bei der Generierung
+ TextureAttributes* pAttributes;
+
+ // Gibt die Haeufigkeit der Benutzung wieder
+ UINT16 nUsageCount;
+
+ // Farbe fuer Base3DTextureBlend - Modus
+ BitmapColor aColBlend;
+
+ // Farbe, wenn keine Textur an einer Stelle liegt
+ BitmapColor aColTexture;
+
+ // Art der Textur
+ Base3DTextureKind eKind;
+
+ // Modus der Textur
+ Base3DTextureMode eMode;
+
+ // Filter
+ Base3DTextureFilter eFilter;
+
+ // Wrapping-Modes fuer beide Freiheitsgrade
+ Base3DTextureWrap eWrapS;
+ Base3DTextureWrap eWrapT;
+
+ // Entscheidungsvariable
+ UINT8 nSwitchVal;
+
+ // Vorbestimmbare interne booleans
+ unsigned bTextureKindChanged : 1;
+
+ // Konstruktor / Destruktor
+ B3dTexture(TextureAttributes& rAtt,
+ Bitmap& rBmp,
+ Base3DTextureKind=Base3DTextureColor,
+ Base3DTextureMode=Base3DTextureReplace,
+ Base3DTextureFilter=Base3DTextureNearest,
+ Base3DTextureWrap eS=Base3DTextureSingle,
+ Base3DTextureWrap eT=Base3DTextureSingle);
+ virtual ~B3dTexture();
+
+ // Interne Zugriffsfunktion auf die BitMapFarben
+ inline const BitmapColor GetBitmapColor(long nX, long nY);
+
+ // Verwaltung UsageCount
+ void Touch() { nUsageCount=B3D_TEXTURE_LIFETIME; }
+ void DecrementUsageCount() { if(nUsageCount) nUsageCount--; }
+ UINT16 GetUsageCount() { return nUsageCount; };
+ void SetSwitchVal();
+
+public:
+ // Zugriff auf die Attribute der Textur
+ TextureAttributes& GetAttributes();
+
+ // Zugriff auf Bitmap
+ Bitmap& GetBitmap() { return aBitmap; }
+ const Size GetBitmapSize() { return aBitmap.GetSizePixel(); }
+
+ // Texturfunktion
+ void ModifyColor(Color& rCol, double fS, double fT);
+
+ // Art der Pixeldaten lesen/bestimmen
+ void SetTextureKind(Base3DTextureKind eNew);
+ Base3DTextureKind GetTextureKind() { return eKind; }
+
+ // Texturmodus lesen/bestimmen
+ void SetTextureMode(Base3DTextureMode eNew);
+ Base3DTextureMode GetTextureMode() { return eMode; }
+
+ // Filtermodus lesen/bestimmen
+ void SetTextureFilter(Base3DTextureFilter eNew);
+ Base3DTextureFilter GetTextureFilter() { return eFilter; }
+
+ // Wrapping fuer beide Freiheitsgrade lesen/bestimmen
+ void SetTextureWrapS(Base3DTextureWrap eNew);
+ Base3DTextureWrap GetTextureWrapS() { return eWrapS; }
+ void SetTextureWrapT(Base3DTextureWrap eNew);
+ Base3DTextureWrap GetTextureWrapT() { return eWrapT; }
+
+ // Blend-Color lesen/bestimmen
+ void SetBlendColor(Color rNew);
+ Color GetBlendColor();
+
+ // Textur-Ersatz-Color lesen/bestimmen
+ void SetTextureColor(Color rNew);
+ Color GetTextureColor();
+
+protected:
+ // Zugriff auf Konstruktor/Destruktor nur fuer die verwaltenden Klassen
+ friend class Base3D;
+ friend class Base3DOpenGL;
+ friend class B3dTextureStore;
+};
+
+/*************************************************************************
+|*
+|* erweiterte Klasse fuer Texturen in Base3DOpenGL
+|*
+\************************************************************************/
+
+class B3dTextureOpenGL : public B3dTexture
+{
+private:
+ // Name dieser Textur in OpenGL
+ GLuint nTextureName;
+
+ // Konstruktor / Destruktor
+ B3dTextureOpenGL(TextureAttributes& rAtt,
+ Bitmap& rBmp,
+ OpenGL& rOGL,
+ Base3DTextureKind=Base3DTextureColor,
+ Base3DTextureMode=Base3DTextureReplace,
+ Base3DTextureFilter=Base3DTextureNearest,
+ Base3DTextureWrap eS=Base3DTextureClamp,
+ Base3DTextureWrap eT=Base3DTextureClamp);
+ virtual ~B3dTextureOpenGL();
+
+ // In OpenGL die Textur zerstoeren
+ void DestroyOpenGLTexture(OpenGL&);
+
+public:
+ // Setze diese Textur in OpenGL als aktuelle Textur
+ void MakeCurrentTexture(OpenGL&);
+
+ // Erzeuge diese Textur als OpenGL-Textur
+ void CreateOpenGLTexture(OpenGL&);
+
+protected:
+ // Zugriff auf Konstruktor/Destruktor nur fuer die verwaltenden Klassen
+ friend class Base3D;
+ friend class Base3DOpenGL;
+ friend class B3dTextureStore;
+};
+
+
+#endif // _B3D_B3DTEX_HXX
diff --git a/goodies/inc/b3dtrans.hxx b/goodies/inc/b3dtrans.hxx
new file mode 100644
index 000000000000..75e393515e42
--- /dev/null
+++ b/goodies/inc/b3dtrans.hxx
@@ -0,0 +1,371 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dtrans.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DTRANS_HXX
+#define _B3D_B3DTRANS_HXX
+
+#ifndef _B3D_HMATRIX_HXX
+#include "hmatrix.hxx"
+#endif
+
+// Zu verwendender DephRange des Z-Buffers
+#define ZBUFFER_DEPTH_RANGE (256.0 * 256.0 * 256.0)
+
+// Vorausdeklarationen
+class Base3D;
+class B3dVolume;
+
+/*************************************************************************
+|*
+|* Unterstuetzte Methoden, um das Seitenverhaeltnis einzuhalten
+|*
+\************************************************************************/
+
+enum Base3DRatio
+{
+ Base3DRatioGrow = 1,
+ Base3DRatioShrink,
+ Base3DRatioMiddle
+};
+
+/*************************************************************************
+|*
+|* Typ der Projektion
+|*
+\************************************************************************/
+
+enum Base3DProjectionType
+{
+ Base3DProjectionTypeParallel = 1,
+ Base3DProjectionTypePerspective
+};
+
+/*************************************************************************
+|*
+|* Transformationen fuer alle 3D Ausgaben
+|*
+\************************************************************************/
+
+class B3dTransformationSet
+{
+private:
+ // Object Matrix Object -> World
+ Matrix4D aObjectTrans;
+ Matrix4D aInvObjectTrans;
+
+ // Orientation Matrix
+ Matrix4D aOrientation;
+ Matrix4D aInvOrientation;
+
+ // Projection Matrix
+ Matrix4D aProjection;
+ Matrix4D aInvProjection;
+
+ // Texture Matrices
+ Matrix4D aTexture;
+
+ // Speziell zum Umwandeln von Punkten Objekt -> Device
+ Matrix4D aObjectToDevice;
+
+ // Transponierte Inverse fuer Vectortransformationen
+ Matrix4D aInvTransObjectToEye;
+
+ // Transformation World->View
+ Matrix4D aMatFromWorldToView;
+ Matrix4D aInvMatFromWorldToView;
+
+ // Parameters for ViewportTransformation
+ Vector3D aScale;
+ Vector3D aTranslate;
+
+ // ViewPlane DeviceRectangle (vom Benutzer gesetzt)
+ double fLeftBound;
+ double fRightBound;
+ double fBottomBound;
+ double fTopBound;
+
+ // Near and far clipping planes
+ double fNearBound;
+ double fFarBound;
+
+ // Seitenverhaeltnis der 3D Abbildung (Y / X)
+ // default ist 1:1 -> 1.0
+ // Deaktivieren mit 0.0 als Wert
+ double fRatio;
+
+ // Der gesetzte Ausgabebereich (in logischen Koordinaten)
+ // und der dazugehoerige sichtbare Bereich
+ Rectangle aViewportRectangle;
+ Rectangle aVisibleRectangle;
+
+ // Die tatsaechlich von CalcViewport gesetzten Abmessungen
+ // des sichtbaren Bereichs (in logischen Koordinaten)
+ Rectangle aSetBound;
+
+ // Methode zur Aufrechterhaltung des Seitenverhaeltnisses
+ // default ist Base3DRatioGrow
+ Base3DRatio eRatio;
+
+ // Flags
+ unsigned bPerspective : 1;
+ unsigned bWorldToViewValid : 1;
+ unsigned bInvTransObjectToEyeValid : 1;
+ unsigned bObjectToDeviceValid : 1;
+ unsigned bProjectionValid : 1;
+
+public:
+ B3dTransformationSet();
+
+ // Zurueck auf Standard
+ void Reset();
+
+ // ObjectTrans
+ void SetObjectTrans(Matrix4D& rObj);
+ const Matrix4D& GetObjectTrans() { return aObjectTrans; }
+ const Matrix4D& GetInvObjectTrans() { return aInvObjectTrans; }
+
+ // Orientation
+#ifndef ICC
+ void SetOrientation(Vector3D& aVRP = Vector3D(0.0,0.0,1.0),
+ Vector3D& aVPN = Vector3D(0.0,0.0,1.0),
+ Vector3D& aVUP = Vector3D(0.0,1.0,0.0));
+#else
+ void SetOrientation(Vector3D aVRP = Vector3D(0.0,0.0,1.0),
+ Vector3D aVPN = Vector3D(0.0,0.0,1.0),
+ Vector3D aVUP = Vector3D(0.0,1.0,0.0));
+#endif
+ void SetOrientation(Matrix4D& mOrient);
+ const Matrix4D& GetOrientation() { return aOrientation; }
+ const Matrix4D& GetInvOrientation() { return aInvOrientation; }
+
+ // Projection
+ void SetProjection(Matrix4D& mProject);
+ const Matrix4D& GetProjection();
+ const Matrix4D& GetInvProjection();
+
+ // Texture
+ void SetTexture(Matrix4D& rTxt);
+ const Matrix4D& GetTexture() { return aTexture; }
+
+ // Seitenverhaeltnis und Modus zu dessen Aufrechterhaltung
+ double GetRatio() { return fRatio; }
+ void SetRatio(double fNew=1.0);
+ Base3DRatio GetRatioMode() { return eRatio; }
+ void SetRatioMode(Base3DRatio eNew=Base3DRatioGrow);
+
+ // Parameter der ViewportTransformation
+ void SetDeviceRectangle(double fL=-1.0, double fR=1.0, double fB=-1.0, double fT=1.0,
+ BOOL bBroadCastChange=TRUE);
+ void SetDeviceVolume(const B3dVolume& rVol, BOOL bBroadCastChange=TRUE);
+ void GetDeviceRectangle(double &fL, double &fR, double& fB, double& fT);
+ B3dVolume GetDeviceVolume();
+ double GetDeviceRectangleWidth() const { return fRightBound - fLeftBound; }
+ double GetDeviceRectangleHeight() const { return fTopBound - fBottomBound; }
+ void SetFrontClippingPlane(double fF=0.0);
+ double GetFrontClippingPlane() { return fNearBound; }
+ void SetBackClippingPlane(double fB=1.0);
+ double GetBackClippingPlane() { return fFarBound; }
+ void SetPerspective(BOOL bNew);
+ BOOL GetPerspective() { return bPerspective; }
+ void SetViewportRectangle(Rectangle& rRect, Rectangle& rVisible);
+ void SetViewportRectangle(Rectangle& rRect) { SetViewportRectangle(rRect, rRect); }
+ const Rectangle& GetViewportRectangle() { return aViewportRectangle; }
+ void CalcViewport();
+
+ // Spezielle Matritzen anfordern
+ Matrix4D GetMatFromObjectToView();
+
+ // Transponierte Inverse fuer Vectortransformationen
+ const Matrix4D& GetInvTransObjectToEye();
+
+ // Speziell zum Umwandeln von Punkten Objekt -> Device
+ const Matrix4D& GetObjectToDevice();
+
+ // Speziell zum Umwandeln von Punkten World -> View
+ const Matrix4D& GetMatFromWorldToView();
+ const Matrix4D& GetInvMatFromWorldToView();
+
+ // Bounds des Viewports lesen
+ const Rectangle& GetLogicalViewportBounds();
+ const Vector3D& GetScale();
+ const Vector3D& GetTranslate();
+
+ // Direkter Zugriff auf verschiedene Transformationen
+ const Vector3D WorldToEyeCoor(const Vector3D& rVec);
+ const Vector3D EyeToWorldCoor(const Vector3D& rVec);
+ const Vector3D EyeToViewCoor(const Vector3D& rVec);
+ const Vector3D ViewToEyeCoor(const Vector3D& rVec);
+ const Vector3D WorldToViewCoor(const Vector3D& rVec);
+ const Vector3D ViewToWorldCoor(const Vector3D& rVec);
+ const Vector3D DeviceToViewCoor(const Vector3D& rVec);
+ const Vector3D ViewToDeviceCoor(const Vector3D& rVec);
+ const Vector3D ObjectToWorldCoor(const Vector3D& rVec);
+ const Vector3D WorldToObjectCoor(const Vector3D& rVec);
+ const Vector3D ObjectToViewCoor(const Vector3D& rVec);
+ const Vector3D ViewToObjectCoor(const Vector3D& rVec);
+ const Vector3D ObjectToEyeCoor(const Vector3D& rVec);
+ const Vector3D EyeToObjectCoor(const Vector3D& rVec);
+ const Vector3D DeviceToEyeCoor(const Vector3D& rVec);
+ const Vector3D EyeToDeviceCoor(const Vector3D& rVec);
+
+ const Vector3D InvTransObjectToEye(const Vector3D& rVec);
+ const Vector3D TransTextureCoor(const Vector3D& rVec);
+
+protected:
+ void PostSetObjectTrans();
+ void PostSetOrientation();
+ void PostSetProjection();
+ void PostSetTexture();
+ void PostSetViewport();
+
+ void CalcMatObjectToDevice();
+ void CalcMatFromWorldToView();
+ void CalcMatInvTransObjectToEye();
+
+ virtual void DeviceRectangleChange();
+};
+
+/*************************************************************************
+|*
+|* Viewport fuer B3D
+|*
+|* Verwendet wird hier ein vereinfachtes System, bei dem der abzubildende
+|* Punkt durch VRP repraesentiert wird
+|*
+\************************************************************************/
+
+class B3dViewport : public B3dTransformationSet
+{
+private:
+ Vector3D aVRP; // View Reference Point
+ Vector3D aVPN; // View Plane Normal
+ Vector3D aVUV; // View Up Vector
+
+public:
+ B3dViewport();
+
+ void SetVRP(const Vector3D& rNewVRP);
+ void SetVPN(const Vector3D& rNewVPN);
+ void SetVUV(const Vector3D& rNewVUV);
+ void SetViewportValues(
+ const Vector3D& rNewVRP,
+ const Vector3D& rNewVPN,
+ const Vector3D& rNewVUV);
+
+ const Vector3D& GetVRP() const { return aVRP; }
+ const Vector3D& GetVPN() const { return aVPN; }
+ const Vector3D& GetVUV() const { return aVUV; }
+
+protected:
+ void CalcOrientation();
+};
+
+/*************************************************************************
+|*
+|* Kamera fuer B3D
+|*
+\************************************************************************/
+
+class B3dCamera : public B3dViewport
+{
+private:
+ Vector3D aPosition;
+ Vector3D aCorrectedPosition;
+ Vector3D aLookAt;
+ double fFocalLength;
+ double fBankAngle;
+
+ unsigned bUseFocalLength : 1;
+
+public:
+ B3dCamera(const Vector3D& rPos = Vector3D(0.0, 0.0, 1.0),
+ const Vector3D& rLkAt = Vector3D(0.0, 0.0, 0.0),
+ double fFocLen = 35.0, double fBnkAng = 0.0,
+ BOOL bUseFocLen = FALSE);
+
+ // Positionen
+ void SetPosition(const Vector3D& rNewPos);
+ const Vector3D& GetPosition() const { return aPosition; }
+ void SetLookAt(const Vector3D& rNewLookAt);
+ const Vector3D& GetLookAt() const { return aLookAt; }
+ void SetPositionAndLookAt(const Vector3D& rNewPos, const Vector3D& rNewLookAt);
+
+ // Brennweite in mm
+ void SetFocalLength(double fLen);
+ double GetFocalLength() const { return fFocalLength; }
+
+ // Neigung links/rechts
+ void SetBankAngle(double fAngle);
+ double GetBankAngle() const { return fBankAngle; }
+
+ // FocalLength Flag
+ void SetUseFocalLength(BOOL bNew);
+ BOOL GetUseFocalLength() const { return (BOOL)bUseFocalLength; }
+
+protected:
+ void CalcNewViewportValues();
+ BOOL CalcFocalLength();
+
+ virtual void DeviceRectangleChange();
+};
+
+
+#endif // _B3D_B3DTRANS_HXX
diff --git a/goodies/inc/b3dvolum.hxx b/goodies/inc/b3dvolum.hxx
new file mode 100644
index 000000000000..61bf6b7eedf2
--- /dev/null
+++ b/goodies/inc/b3dvolum.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dvolum.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_VOLUM_HXX
+#define _B3D_VOLUM_HXX
+
+#ifndef _SVX_VECTOR3D_HXX
+#include "vector3d.hxx"
+#endif
+
+#ifndef _INC_FLOAT
+#include
+#endif
+
+#ifndef _STREAM_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* dreidimensionales Volumen, symmetrisch zu den Koordinatenachsen
+|*
+\************************************************************************/
+
+class B3dVolume
+{
+ friend class Vol3DPointIterator;
+
+ protected:
+ Vector3D aMinVec;
+ Vector3D aMaxVec;
+
+ public:
+ B3dVolume(const Vector3D& rPos, const Vector3D& r3DSize,
+ BOOL bPosIsCenter = TRUE);
+ B3dVolume();
+
+ void Reset();
+ BOOL IsValid() const;
+
+ B3dVolume& Union(const B3dVolume& rVol2);
+ B3dVolume& Union(const Vector3D& rVec);
+
+ const Vector3D& MinVec() const { return aMinVec; }
+ Vector3D& MinVec() { return aMinVec; }
+
+ const Vector3D& MaxVec() const { return aMaxVec; }
+ Vector3D& MaxVec() { return aMaxVec; }
+
+ double GetWidth() const { return aMaxVec.X() - aMinVec.X(); }
+ double GetHeight() const { return aMaxVec.Y() - aMinVec.Y(); }
+ double GetDepth() const { return aMaxVec.Z() - aMinVec.Z(); }
+ Vector3D GetSize() const;
+ BOOL IsInside(const Vector3D& rVec);
+
+ friend SvStream& operator>>(SvStream& rIStream, B3dVolume&);
+ friend SvStream& operator<<(SvStream& rOStream, const B3dVolume&);
+};
+
+
+#endif // _B3D_VOLUM_HXX
diff --git a/goodies/inc/chagent.hxx b/goodies/inc/chagent.hxx
new file mode 100644
index 000000000000..c0c1a70fbcac
--- /dev/null
+++ b/goodies/inc/chagent.hxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * $RCSfile: chagent.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _CHAGENT_HXX
+#define _CHAGENT_HXX
+
+#ifndef _LIST_HXX //autogen
+#include
+#endif
+#ifndef _URLOBJ_HXX
+#include
+#endif
+
+#include
+
+class ChannelAgentItem;
+class ChannelItem;
+
+DECLARE_LIST(ChannelAgentItemList,ChannelAgentItem*)
+
+enum AgentType
+{
+ AG_TYP_DONTKNOW = 0,
+ AG_TYP_DLL = 1,
+ AG_TYP_BASIC = 2,
+ AG_TYP_JAVA = 3
+};
+
+#define STR_AG_TYP_DLL "DLL"
+#define STR_AG_TYP_BASIC "BASIC"
+#define STR_AG_TYP_JAVA "JAVA"
+
+class ChannelAgentItem : public AgentItem
+{
+ AgentType eAgentType;
+ String aChAgentName;
+ INetURLObject aLocation;
+ ULONG nLastSuccUpdDate;
+ long nLastSuccUpdTime;
+ INetURLObject aSource;
+ BOOL bEnabled;
+ DateTime aLastCheckDate;
+
+ // runtime
+ BOOL bIsActive;
+ BOOL bIsInUpdate;
+ BOOL bRestartAfterUpdate;
+
+ ULONG nChObjDate;
+ long nChObjTime;
+ ChannelItem* pActChannel;
+ AgentApi* pAgentApi;
+ ChannelApi* pChannelApi;
+ INetURLObject aSourceURL;
+
+ Link aBTXShutdownCallback;
+
+protected:
+ friend class ChannelApi;
+ void DeleteApis();
+
+public:
+ ChannelAgentItem();
+ ~ChannelAgentItem();
+
+ // Set / Get AgentType
+ void SetChannelAgentType(AgentType eNew)
+ { eAgentType = eNew; }
+ AgentType GetChannelAgentType() const
+ { return eAgentType; }
+
+ // Set / Get ChAgentName
+ void SetChAgentName(const String& rNew)
+ { aChAgentName = rNew; }
+ virtual const String& GetChAgentName() const
+ { return aChAgentName; }
+
+ // Set / Get Location
+ void SetLocation(const INetURLObject& rNew)
+ { aLocation = rNew; }
+ virtual const INetURLObject& GetLocation() const
+ { return aLocation; }
+
+ // Set / Get LastSuccUpdDate
+ void SetLastSuccUpdDate(ULONG nNew)
+ { nLastSuccUpdDate = nNew; }
+ ULONG GetLastSuccUpdDate() const
+ { return nLastSuccUpdDate; }
+
+ // Set / Get LastSuccUpdTime
+ void SetLastSuccUpdTime(ULONG nNew)
+ { nLastSuccUpdTime = nNew; }
+ ULONG GetLastSuccUpdTime() const
+ { return nLastSuccUpdTime; }
+
+ // Set / Get LastCheckDate
+ void SetLastCheckDate( const DateTime& rNew )
+ { aLastCheckDate = rNew; }
+ const DateTime& GetLastCheckDate()
+ { return aLastCheckDate; }
+
+ // Set / Get Source
+ void SetSource(const INetURLObject& rNew)
+ { aSource = rNew; }
+ const INetURLObject& GetSource() const
+ { return aSource; }
+
+ // Set / Get Enabled
+ virtual void SetEnabled(BOOL bNew = TRUE)
+ { bEnabled = bNew; }
+ virtual BOOL IsEnabled() const
+ { return bEnabled; }
+
+ // Set / Get IsActive
+ virtual void SetIsActive(BOOL bNew)
+ { bIsActive = bNew; }
+ virtual BOOL IsActive() const
+ { return bIsActive; }
+
+ // runtime ////////////////////////////////////////////////////////////////
+
+ const INetURLObject& GetAgentSourceURL() const
+ { return aSourceURL; }
+ void SetAgentSourceURL(const INetURLObject& rNew)
+ { aSourceURL = rNew; }
+
+ // Set / Get ActiveChannel
+ void SetActiveChannel(ChannelItem* pChItem)
+ { pActChannel = pChItem; }
+ ChannelItem* GetActiveChannel() const
+ { return pActChannel; }
+
+ // Set / Get IsInUpdate
+ void SetIsInUpdate( BOOL bNew )
+ { bIsInUpdate = bNew; }
+ BOOL IsInUpdate() const
+ { return bIsInUpdate; }
+
+ // Set / Get RestartAfterUpdate
+ void SetRestartAfterUpdate( BOOL bNew )
+ { bRestartAfterUpdate = bNew; }
+ BOOL RestartAfterUpdate() const
+ { return bRestartAfterUpdate; }
+
+ // AgentAPI
+ void SetApi(AgentApi* pNew )
+ { pAgentApi = pNew; }
+ virtual AgentApi* GetApi() const
+ { return pAgentApi; }
+
+ // ChannelAPI
+ void SetChApi(ChannelApi* pNew )
+ { pChannelApi = pNew; }
+ virtual ChApi* GetChApi() const
+ { return (ChApi*)pChannelApi; }
+
+ // Set / Get ChObjDate
+ void SetChObjDate(ULONG nNew)
+ { nChObjDate = nNew; }
+ ULONG GetChObjDate() const
+ { return nChObjDate; }
+
+ // Set / Get ChObjTime
+ void SetChObjTime(long nNew)
+ { nChObjTime = nNew; }
+ long GetChObjTime() const
+ { return nChObjTime; }
+
+ void SetBTXShutDownCallBack(const Link& rLnk )
+ { aBTXShutdownCallback = rLnk; }
+ const Link& GetBTXShutDownCallBack()
+ { return aBTXShutdownCallback; }
+
+};
+
+#endif // _CHAGENT_HXX
diff --git a/goodies/inc/chanapi.hxx b/goodies/inc/chanapi.hxx
new file mode 100644
index 000000000000..6831b15505bd
--- /dev/null
+++ b/goodies/inc/chanapi.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: chanapi.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _CHANAPI_HXX
+#define _CHANAPI_HXX
+
+
+#ifndef _LIST_HXX //autogen
+#include
+#endif
+#include
+
+#ifndef _INETSES_HXX //autogen
+#include
+#endif
+
+class ChannelAgentItem;
+class ChannelList;
+class INetURLObject;
+class GetChannelObj;
+
+DECLARE_LIST(GetChObjList, GetChannelObj*);
+
+class ChannelApi : public ChApi
+{
+ INetSessionRef xINetSession;
+
+ ChannelAgentItem* pChAgent;
+ ChannelList* pChannelList;
+
+ GetChObjList* pGetChObjList;
+
+ DECL_LINK(CloseAgentEvt, void*);
+ DECL_LINK(CloseChannelObjEvt, void*);
+ DECL_LINK(GetChannelObjNotify, GetChannelObj*);
+public:
+ ChannelApi( ChannelAgentItem* pAgent, INetSession* pISess,
+ ChannelList* pChLst );
+ ~ChannelApi();
+
+ void ShutDownAgent();
+ void SetLastSuccUpd();
+
+ void GetChannelObject( const INetURLObject& rURL, RequestType eStreamType,
+ const String& rFileName );
+ void AddChannelItem( const String& aChName, const INetURLObject& aTransmitter,
+ const String& aChannel, USHORT nUpdPeriode,
+ const String& rChAgentName );
+ void DelChannelItem( const String& aChName );
+ void SetChTransmitter( const String& aChName, const String& rNewVal );
+ void SetChannel( const String& aChName, const String& rNewVal );
+ void SetChannelName( const String& aChName, const String& rNewVal );
+ void SetChUpdPeriode( const String& aChName, USHORT nUpdPeriode );
+ void SetChannelAgentName( const String& aChName, const String& rNewVal );
+
+ void SetUpdateTransmitter(ChannelAgentItem* pAgent, const INetURLObject& rTransmitter);
+};
+
+#endif //_CHANAPI_HXX
diff --git a/goodies/inc/channel.hxx b/goodies/inc/channel.hxx
new file mode 100644
index 000000000000..90ab84a3fd48
--- /dev/null
+++ b/goodies/inc/channel.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: channel.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _CHANNEL_HXX
+#define _CHANNEL_HXX
+
+#ifndef _LIST_HXX //autogen
+#include
+#endif
+#ifndef _URLOBJ_HXX
+#include
+#endif
+
+class ChannelItem;
+DECLARE_LIST(ChannelItemList,ChannelItem*)
+
+class ChannelItem
+{
+ INetURLObject aTransmitter;
+ String aChannel;
+ String aChannelName;
+ String aChannelAgentName;
+ ULONG nUpdatePeriode;
+ ULONG nLastTimerTick;
+ ULONG nLastSuccUpdDate;
+ long nLastSuccUpdTime;
+
+ BOOL bAgentUpdChannel;
+
+public:
+ ChannelItem();
+ ~ChannelItem();
+
+ // Set / Get Transmitter
+ void SetTransmitter(const INetURLObject& rNew)
+ { aTransmitter = rNew; }
+ const INetURLObject& GetTransmitter() const
+ { return aTransmitter; }
+
+ // Set / Get Channel
+ void SetChannel(const String& rNew)
+ { aChannel = rNew; }
+ const String& GetChannel() const
+ { return aChannel; }
+
+ // Set / Get ChannelName
+ void SetChannelName(const String& rNew)
+ { aChannelName = rNew; }
+ const String& GetChannelName() const
+ { return aChannelName; }
+
+ // Set / Get ChannelAgentName
+ void SetChannelAgentName(const String& rNew)
+ { aChannelAgentName = rNew; }
+ const String& GetChannelAgentName() const
+ { return aChannelAgentName; }
+
+ // Set / Get UpdatePeriode
+ void SetUpdatePeriode(ULONG nNew)
+ { nUpdatePeriode = nNew; }
+ ULONG GetUpdatePeriode() const
+ { return nUpdatePeriode; }
+
+ // Set / Get LastTimerTick
+ void SetLastTimerTick(ULONG nNew)
+ { nLastTimerTick = nNew; }
+ ULONG GetLastTimerTick() const
+ { return nLastTimerTick; }
+
+ // Set / Get LastSuccUpdDate
+ void SetLastSuccUpdDate(ULONG nNew)
+ { nLastSuccUpdDate = nNew; }
+ ULONG GetLastSuccUpdDate() const
+ { return nLastSuccUpdDate; }
+
+ // Set / Get LastSuccUpdTime
+ void SetLastSuccUpdTime(long nNew)
+ { nLastSuccUpdTime = nNew; }
+ long GetLastSuccUpdTime() const
+ { return nLastSuccUpdTime; }
+
+ // Set / Get AgentUpdChannel
+ void SetAgentUpdChannel(BOOL bNew)
+ { bAgentUpdChannel = bNew; }
+ BOOL GetAgentUpdChannel() const
+ { return bAgentUpdChannel; }
+};
+
+#endif // _CHANNEL_HXX
+
diff --git a/goodies/inc/chlist.hxx b/goodies/inc/chlist.hxx
new file mode 100644
index 000000000000..1178e4f05cb0
--- /dev/null
+++ b/goodies/inc/chlist.hxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: chlist.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _CHLIST_HXX
+#define _CHLIST_HXX
+
+#ifndef _URLOBJ_HXX //autogen
+#include
+#endif
+#ifndef _DATETIME_HXX //autogen
+#include
+#endif
+#ifndef _STRING_HXX //autogen
+#include
+#endif
+#ifndef _TIMER_HXX //autogen
+#include
+#endif
+#ifndef _LIST_HXX //autogen
+#include
+#endif
+#ifndef _INETSES_HXX //autogen
+#include
+#endif
+
+class Downloader;
+class ChannelAgentItem;
+class ChannelItem;
+class ChannelItemList;
+class ChannelAgentItemList;
+class ChannelTuner;
+class ChannelApi;
+class GetChannelObj;
+class GetChObjList;
+class NotifyItem;
+class Date;
+class Time;
+class ResMgr;
+
+struct UiAgentItem
+{
+ String aName;
+ ULONG aUpdPeriode;
+ DateTime aLastDataDate;
+ DateTime aLastUpdDate;
+ BOOL bUnregister;
+ BOOL bIsEnabled;
+};
+
+DECLARE_LIST(UiAgentList, UiAgentItem*)
+DECLARE_LIST(NotifyList, NotifyItem*)
+
+#ifndef STRING_LIST
+#define STRING_LIST
+#if SUPD >= 380
+#define _TOOLS_STRINGLIST
+#ifndef _SSTRING_HXX
+#include
+#endif
+#else
+DECLARE_LIST(StringList, String*)
+#endif
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//
+#define JOBID_DOWNLOAD_AGENT 1
+#define JOBID_UPDATE_AGENT 2
+#define JOBID_CHECK_TRANSMITTER 3
+
+struct BTXResponse
+{
+ USHORT nJobId;
+ BOOL bFinish;
+ ULONG nTransferStatus;
+ String aLocalFileName;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//
+class ChannelList
+{
+ ResMgr* pResMgr;
+ ChannelAgentItemList* pAgentList;
+ ChannelItemList* pChannelList;
+ NotifyList* pNotifyList;
+ GetChObjList* pGetChObjList;
+ UiAgentList* pUiAgentList;
+
+ ChannelTuner* pChannelTuner;
+
+ String aAgentPath;
+ AutoTimer aTimer;
+ INetSessionRef xINetSession;
+
+ Link aNotifyPermissionHdl;
+ Link aCheckFinishHdl;
+ // wird von der ChannelList gehandelt; sollte ausgebaut werden; auch im SFX
+ Link aAgentUpdateHdl;
+ Downloader* pBTXDecoder;
+
+ void MakeGodChannel(ChannelAgentItem* pAgent);
+ void DeleteUiAgentList();
+
+ BOOL StartAgent(ChannelAgentItem* pAgent);
+
+ void DoNotifyAgents();
+ void NotifyAgent(ChannelAgentItem* pAgent, ULONG nNotifyItemIdx);
+
+ void UpdateAgent(ChannelAgentItem* pAgent, ULONG nNotifyItemIdx);
+ void SendItemToTuner(ChannelItem* pItem);
+
+ BOOL ParseDateTime(const String& rSrc, Date& rDate, Time& rTime);
+
+ void UnZipAgent(ChannelAgentItem* pAgent);
+ static void EnumFilesCallBack(char *pFile, void *pObject);
+
+ DECL_LINK(CheckChannels, void*);
+ DECL_LINK(CloseChannelObjEvt, void*);
+ DECL_LINK(GetChannelObjNotify, GetChannelObj*);
+protected:
+ friend class ChannelApi;
+ friend class ChannelTuner;
+
+ ChannelItem* GetChannelItemByName(const String& rName);
+ ChannelAgentItem* GetAgentItemByName(const String& rName);
+
+ void ReadChannelList();
+ void ReadAgentList();
+ void WriteChannelItem(ChannelItem* pItem);
+ void WriteAgentItem(ChannelAgentItem* pChAgent);
+ void SetLastSuccUpdChannel(ChannelAgentItem* pChAgent);
+ void SetLastSuccUpdAgent(ChannelAgentItem* pChAgent);
+ void SetEnabledAgent(ChannelAgentItem* pChAgent);
+
+ void DeleteAgentItem(ChannelAgentItem* pItem);
+ void DeleteChannelItem(ChannelItem* pItem);
+ void RegisterNewChannelItem(ChannelItem* pItem);
+
+ void CancelBTX();
+ Downloader* GetBTXDecoder() const { return pBTXDecoder; }
+ ResMgr* GetResMgr() const { return pResMgr; }
+
+ DECL_LINK(CheckBTXFinishHdl, void*);
+
+ void NotifyTransmitterMsg(const String& rStr);
+
+public:
+ ChannelList(const String& rAgentPath);
+ ~ChannelList();
+
+ void SubscribeNewAgent(const INetURLObject& rURL);
+
+ void SetINetSession(INetSession* pNewSess);
+ void SetBTXDecoder(Downloader* pDecoder);
+
+ void SetNotifyPermissionHdl(const Link& rHdl) { aNotifyPermissionHdl = rHdl; }
+ void SetAgentUpdateHdl(const Link& rHdl) { aAgentUpdateHdl = rHdl; }
+
+ void SetTimerInterval(ULONG nNew);
+ void StartCheckChannels();
+ void StopCheckChannels();
+
+ void CheckAgentNow(const String& rAgName, BOOL bCheckGOD = FALSE);
+ void SetCheckFinishHdl(const Link& rHdl) { aCheckFinishHdl = rHdl; }
+ const Link& GetCheckFinishHdl() const { return aCheckFinishHdl;};
+
+ UiAgentList* GetUiAgentList();
+ void JoinUiAgentList();
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//
+class NotifyItem
+{
+ ChannelItem* pChItem;
+
+ USHORT nGMTOffset;
+ ULONG nDateLastUpd;
+ long nTimeLastUpd;
+ INetURLObject aChObjURL;
+ String aChName;
+public:
+ NotifyItem( ChannelItem* pItem, short nGMTOff, ULONG nLastDate,
+ ULONG nLastTime, const INetURLObject& rChObjURL,
+ const String& rChName);
+ ~NotifyItem();
+
+ ChannelItem* GetChannelItem() const { return pChItem; }
+
+ const String& GetChannelName() const { return aChName; }
+ const INetURLObject GetChannelObjURL() const { return aChObjURL; }
+
+ void SetDateLastUpd(ULONG nNew) { nDateLastUpd = nNew; }
+ ULONG GetDateLastUpd() const { return nDateLastUpd; }
+
+ void SetTimeLastUpd(long nNew) { nTimeLastUpd = nNew; }
+ long GetTimeLastUpd() const { return nTimeLastUpd; }
+
+ const String& GetChAgentName() const;
+
+};
+
+#endif // _CHLIST_HXX
+
diff --git a/goodies/inc/chresid.hxx b/goodies/inc/chresid.hxx
new file mode 100644
index 000000000000..91e23ab6fbc1
--- /dev/null
+++ b/goodies/inc/chresid.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: chresid.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _CHRESID_HXX
+#define _CHRESID_HXX
+
+///////////////////////////////////////////////////////////////////////////////
+// legt den ResourceManager fuer die ChannelList in den APPDaten ab.
+//
+class ChannelResDll
+{
+public:
+ ChannelResDll();
+ ~ChannelResDll();
+};
+
+#endif //_CHRESID_HXX
+
diff --git a/goodies/inc/chtuner.hxx b/goodies/inc/chtuner.hxx
new file mode 100644
index 000000000000..feedeafdb7de
--- /dev/null
+++ b/goodies/inc/chtuner.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: chtuner.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _CHTUNER_HXX
+#define _CHTUNER_HXX
+
+#ifndef _SV_TIMER_HXX //autogen
+#include
+#endif
+#ifndef _LIST_HXX //autogen
+#include
+#endif
+#ifndef _INETSESS_HXX
+#include
+#endif
+
+
+#ifndef _SFXLSTNER_HXX //autogen
+#include
+#endif
+
+class ChannelItem;
+class ChannelList;
+class INetRequest;
+class Downloader;
+class StringList;
+
+struct RetryInformation
+{
+ String aURL;
+ Time aErrorTime;
+};
+
+DECLARE_LIST(ReqList,INetRequest*)
+DECLARE_LIST(RetryList,RetryInformation*)
+
+class ChannelTuner : public SfxListener
+{
+ ChannelList* pChannelList;
+ INetSessionRef xINetSession;
+ ReqList* pReqList;
+
+ Link aBTXCallBack;
+ Downloader* pBTXDecoder;
+ String aBTXFileName;
+
+ AutoTimer aRetryTimer;
+ RetryList* pRetryList;
+
+ void SendHttpReq(const INetURLObject& rURL);
+ void SendFtpReq(const INetURLObject& rURL);
+ void SendBTXReq(const INetURLObject& rURL);
+ void GetFileTrans(const INetURLObject& rURL);
+
+ void RemoveRequest(INetRequest* pReq);
+ void NotifyChannelList(String& rStr);
+
+ virtual void SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType);
+
+ DECL_LINK(RetryCallBack, void*);
+ DECL_LINK(BTXCallBack, void*);
+public:
+ ChannelTuner(INetSession* pSess, ChannelList* pChList);
+ ~ChannelTuner();
+
+ BOOL RequestChannel(ChannelItem* pItem, const Link& rBTXCallBack);
+
+ void SetINetSession(INetSession* pNewSess);
+ void SetBTXDecoder(Downloader* pDecoder);
+};
+
+#endif // _CHTUNER_HXX
diff --git a/goodies/inc/crypt.hxx b/goodies/inc/crypt.hxx
new file mode 100644
index 000000000000..195398f415ea
--- /dev/null
+++ b/goodies/inc/crypt.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: crypt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 ---------------------------------------------------------------
+#include
+
+// define ----------------------------------------------------------------
+
+#define nInOfs 0x00010000UL
+#define nOutOfs 0x00020000UL
+
+// cryptit ---------------------------------------------------------------
+
+extern "C"
+{
+//ULONG testdll(const String& ,const String& , const String&, BOOL DoCrypt );
+//ULONG __EXPORT testdll(const char* pCrInName, const char* pCrOutName,
+// const char* pCrKey, BOOL DoCrypt=1);
+#if defined (MAC) || defined (UNX)
+extern ULONG cryptit(const char* pCrInName, const char* pCrOutName,
+#else
+#ifdef WNT
+extern ULONG __stdcall cryptit(const char* pCrInName, const char* pCrOutName,
+#else
+#if defined( MTW ) || defined( ICC )
+extern ULONG cryptit(const char* pCrInName, const char* pCrOutName,
+#else
+extern ULONG __pascal cryptit(const char* pCrInName, const char* pCrOutName,
+#endif
+#endif
+#endif
+ const char* pCrKey, USHORT DoCrypt);
+}
+
+
diff --git a/goodies/inc/goodies.hrc b/goodies/inc/goodies.hrc
new file mode 100644
index 000000000000..1ed0c04d9fcb
--- /dev/null
+++ b/goodies/inc/goodies.hrc
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: goodies.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _GOODIES_HRC
+#define _GOODIES_HRC
+
+#ifndef _SOLAR_HRC
+#include
+#endif
+
+// Dialoge ---------------------------------------------------------------
+
+#define DLG_EXPORT_EPCT (RID_GOODIES_START+ 0)
+#define DLG_EXPORT_GIF (RID_GOODIES_START+ 1)
+#define DLG_EXPORT_EMET (RID_GOODIES_START+ 2)
+#define DLG_EXPORT_JPG (RID_GOODIES_START+ 3)
+#define DLG_IMPORT_PCD (RID_GOODIES_START+ 4)
+#define DLG_EXPORT_EPNG (RID_GOODIES_START+ 5)
+#define DLG_EXPORT_EPS (RID_GOODIES_START+ 8)
+#define DLG_EXPORT_EPBM (RID_GOODIES_START+ 9)
+#define DLG_EXPORT_EPGM (RID_GOODIES_START+ 10)
+#define DLG_EXPORT_EPPM (RID_GOODIES_START+ 11)
+#define DLG_SSL_NEWCERT (RID_GOODIES_START+ 12)
+#define DLG_SSL_INFCERT (RID_GOODIES_START+ 13)
+#define PAGE_SSL_NEWCERT_OPEN (RID_GOODIES_START+ 14)
+#define PAGE_SSL_NEWCERT_SHOWCERT (RID_GOODIES_START+ 15)
+#define PAGE_SSL_NEWCERT_ACCEPTCERT (RID_GOODIES_START+ 16)
+#define PAGE_SSL_NEWCERT_WARNCERT (RID_GOODIES_START+ 17)
+#define PAGE_SSL_NEWCERT_READYCERT (RID_GOODIES_START+ 18)
+#define WIN_SSL_INFCERT (RID_GOODIES_START+ 19)
+#define WIN_SSL_INFCERT_EDIT (RID_GOODIES_START+ 20)
+
+#endif
+
diff --git a/goodies/inc/grfmgr.hxx b/goodies/inc/grfmgr.hxx
new file mode 100644
index 000000000000..1d0fb3f78d02
--- /dev/null
+++ b/goodies/inc/grfmgr.hxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * $RCSfile: grfmgr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _GRFMGR_HXX
+#define _GRFMGR_HXX
+
+#ifndef _SV_GRAPH_HXX
+#include
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define GRFMGR_DRAW_NOTCACHED 0x00000000UL
+#define GRFMGR_DRAW_CACHED 0x00000001UL
+#define GRFMGR_DRAW_BILINEAR 0x00000002UL
+#define GRFMGR_DRAW_STANDARD (GRFMGR_DRAW_CACHED|GRFMGR_DRAW_BILINEAR)
+
+// --------------------
+// - AutoSwap Defines -
+// --------------------
+
+#define GRFMGR_AUTOSWAPSTREAM_LINK ((SvStream*)0x00000000UL)
+#define GRFMGR_AUTOSWAPSTREAM_LOADED ((SvStream*)0xfffffffdUL)
+#define GRFMGR_AUTOSWAPSTREAM_TEMP ((SvStream*)0xfffffffeUL)
+#define GRFMGR_AUTOSWAPSTREAM_NONE ((SvStream*)0xffffffffUL)
+
+// ----------------------
+// - Adjustment Defines -
+// ----------------------
+
+#define ADJUSTMENT_NONE 0x00000000UL
+#define ADJUSTMENT_DRAWMODE 0x00000001UL
+#define ADJUSTMENT_COLORS 0x00000002UL
+#define ADJUSTMENT_MIRROR 0x00000004UL
+#define ADJUSTMENT_ROTATE 0x00000008UL
+#define ADJUSTMENT_TRANSPARENCY 0x00000010UL
+#define ADJUSTMENT_ALL 0xFFFFFFFFUL
+
+// ---------
+// - Enums -
+// ---------
+
+enum GraphicDrawMode
+{
+ GRAPHICDRAWMODE_STANDARD = 0,
+ GRAPHICDRAWMODE_GREYS = 1,
+ GRAPHICDRAWMODE_MONO = 2,
+ GRAPHICDRAWMODE_WATERMARK = 3
+};
+
+// ------------
+// - Forwards -
+// ------------
+
+class GraphicManager;
+class SvStream;
+class BitmapWriteAccess;
+class GraphicCache;
+struct GrfSimpleCacheObj;
+
+// ---------------
+// - GraphicAttr -
+// ---------------
+
+class GraphicAttr
+{
+private:
+
+ Size maLogSize;
+ double mfGamma;
+ ULONG mnMirrFlags;
+ long mnLeftCrop;
+ long mnTopCrop;
+ long mnRightCrop;
+ long mnBottomCrop;
+ USHORT mnRotate10;
+ short mnContPercent;
+ short mnLumPercent;
+ short mnRPercent;
+ short mnGPercent;
+ short mnBPercent;
+ BOOL mbInvert;
+ BYTE mcTransparency;
+ GraphicDrawMode meDrawMode;
+ Rectangle maCropRect;
+
+ void* mpDummy;
+
+public:
+
+ GraphicAttr();
+ ~GraphicAttr();
+
+ BOOL operator==( const GraphicAttr& rAttr ) const;
+ BOOL operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); }
+
+ void SetDrawMode( GraphicDrawMode eDrawMode ) { meDrawMode = eDrawMode; }
+ GraphicDrawMode GetDrawMode() const { return meDrawMode; }
+
+ void SetMirrorFlags( ULONG nMirrFlags ) { mnMirrFlags = nMirrFlags; }
+ ULONG GetMirrorFlags() const { return mnMirrFlags; }
+
+ void SetCrop( long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM )
+ {
+ mnLeftCrop = nLeft_100TH_MM; mnTopCrop = nTop_100TH_MM;
+ mnRightCrop = nRight_100TH_MM; mnBottomCrop = nBottom_100TH_MM;
+ }
+ long GetLeftCrop() const { return mnLeftCrop; }
+ long GetTopCrop() const { return mnTopCrop; }
+ long GetRightCrop() const { return mnRightCrop; }
+ long GetBottomCrop() const { return mnBottomCrop; }
+
+ void SetRotation( USHORT nRotate10, const Size& rUnrotatedSize ) { mnRotate10 = nRotate10; maLogSize = rUnrotatedSize; }
+ USHORT GetRotation() const { return mnRotate10; }
+
+ void SetLuminance( short nLuminancePercent ) { mnLumPercent = nLuminancePercent; }
+ short GetLuminance() const { return mnLumPercent; }
+
+ void SetContrast( short nContrastPercent ) { mnContPercent = nContrastPercent; }
+ short GetContrast() const { return mnContPercent; }
+
+ void SetChannelR( short nChannelRPercent ) { mnRPercent = nChannelRPercent; }
+ short GetChannelR() const { return mnRPercent; }
+
+ void SetChannelG( short nChannelGPercent ) { mnGPercent = nChannelGPercent; }
+ short GetChannelG() const { return mnGPercent; }
+
+ void SetChannelB( short nChannelBPercent ) { mnBPercent = nChannelBPercent; }
+ short GetChannelB() const { return mnBPercent; }
+
+ void SetGamma( double fGamma ) { mfGamma = fGamma; }
+ double GetGamma() const { return mfGamma; }
+
+ void SetInvert( BOOL bInvert ) { mbInvert = bInvert; }
+ BOOL IsInvert() const { return mbInvert; }
+
+ void SetTransparency( BYTE cTransparency ) { mcTransparency = cTransparency; }
+ BYTE GetTransparency() const { return mcTransparency; }
+
+ const Size& GetUntransformedSize() const { return maLogSize; }
+
+ BOOL IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); }
+ BOOL IsMirrored() const { return( mnMirrFlags != 0UL ); }
+ BOOL IsCropped() const
+ {
+ return( mnLeftCrop != 0 || mnTopCrop != 0 ||
+ mnRightCrop != 0 || mnBottomCrop != 0 );
+ }
+ BOOL IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); }
+ BOOL IsTransparent() const { return( mcTransparency > 0 ); }
+ BOOL IsAdjusted() const
+ {
+ return( mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 ||
+ mnGPercent != 0 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert );
+ }
+
+ friend SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr );
+ friend SvStream& operator>>( SvStream& rIStm, GraphicAttr& rAttr );
+};
+
+// -----------------
+// - GraphicObject -
+// -----------------
+
+class GraphicObject : public SvDataCopyStream
+{
+ friend class GraphicManager;
+
+private:
+
+ static GraphicManager* mpGlobalMgr;
+
+ Graphic maGraphic;
+ GraphicAttr maAttr;
+ Size maPrefSize;
+ MapMode maPrefMapMode;
+ ULONG mnSizeBytes;
+ GraphicType meType;
+ GraphicManager* mpMgr;
+ String* mpLink;
+ Link* mpSwapStreamHdl;
+ void* mpDummy1;
+ Timer* mpSwapOutTimer;
+ GrfSimpleCacheObj* mpSimpleCache;
+ void* mpDummy2;
+ BOOL mbAutoSwapped : 1;
+ BOOL mbTransparent : 1;
+ BOOL mbAnimated : 1;
+ BOOL mbEPS : 1;
+ BOOL mbIsInSwapIn : 1;
+ BOOL mbIsInSwapOut : 1;
+ BOOL mbDummyFlag7 : 1;
+ BOOL mbDummyFlag8 : 1;
+
+#if __PRIVATE
+
+ void ImplConstruct();
+ void ImplAssignGraphicData();
+ void ImplSetGraphicManager( const GraphicManager* pMgr, const ByteString* pID = NULL );
+ void ImplAutoSwapIn( BOOL bIgnoreSwapState );
+ BOOL ImplIsAutoSwapped() const { return mbAutoSwapped; }
+
+ DECL_LINK( ImplAutoSwapOutHdl, void* );
+
+#endif // __PRIVATE
+
+protected:
+
+ virtual void GraphicManagerDestroyed();
+ virtual SvStream* GetSwapStream() const;
+
+ // !!! to be removed
+ virtual ULONG GetReleaseFromCache() const;
+
+ virtual void Load( SvStream& );
+ virtual void Save( SvStream& );
+ virtual void Assign( const SvDataCopyStream& );
+
+public:
+
+ TYPEINFO();
+
+ GraphicObject( const GraphicManager* pMgr = NULL );
+ GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr = NULL );
+ GraphicObject( const Graphic& rGraphic, const String& rLink, const GraphicManager* pMgr = NULL );
+ GraphicObject( const GraphicObject& rCacheObj, const GraphicManager* pMgr = NULL );
+ GraphicObject( const ByteString& rUniqueID, const GraphicManager* pMgr = NULL );
+ ~GraphicObject();
+
+ GraphicObject& operator=( const GraphicObject& rCacheObj );
+ BOOL operator==( const GraphicObject& rCacheObj ) const;
+ BOOL operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); }
+
+ BOOL HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); }
+ void SetSwapStreamHdl();
+ void SetSwapStreamHdl( const Link& rHdl, const ULONG nSwapOutTimeout = 0UL );
+ Link GetSwapStreamHdl() const;
+ ULONG GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); }
+
+ void FireSwapInRequest();
+ void FireSwapOutRequest();
+
+ void SetGraphicManager( const GraphicManager& rMgr );
+ GraphicManager& GetGraphicManager() const { return *mpMgr; }
+
+ BOOL IsCached( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const GraphicAttr* pAttr = NULL, ULONG nFlags = GRFMGR_DRAW_STANDARD) const;
+ void ReleaseFromCache();
+
+ const Graphic& GetGraphic() const;
+ void SetGraphic( const Graphic& rGraphic );
+ void SetGraphic( const Graphic& rGraphic, const String& rLink );
+
+ Graphic GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const;
+
+ void SetAttr( const GraphicAttr& rAttr );
+ const GraphicAttr& GetAttr() const { return maAttr; }
+
+ BOOL HasLink() const { return( mpLink != NULL && mpLink->Len() > 0 ); }
+ void SetLink();
+ void SetLink( const String& rLink );
+ String GetLink() const;
+
+ ByteString GetUniqueID() const;
+
+ GraphicType GetType() const { return meType; }
+ const Size& GetPrefSize() const { return maPrefSize; }
+ const MapMode& GetPrefMapMode() const { return maPrefMapMode; }
+ ULONG GetSizeBytes() const { return mnSizeBytes; }
+ ULONG GetChecksum() const;
+ BOOL IsTransparent() const { return mbTransparent; }
+ BOOL IsAnimated() const { return mbAnimated; }
+ BOOL IsEPS() const { return mbEPS; }
+
+ void ResetAnimationLoopCount();
+ List* GetAnimationInfoList() const;
+ Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); }
+ void SetAnimationNotifyHdl( const Link& rLink );
+
+ BOOL SwapOut();
+ BOOL SwapOut( SvStream* pOStm );
+ BOOL SwapIn();
+ BOOL SwapIn( SvStream* pIStm );
+
+ BOOL IsInSwapIn() const { return mbIsInSwapIn; }
+ BOOL IsInSwapOut() const { return mbIsInSwapOut; }
+ BOOL IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); }
+ BOOL IsSwappedOut() const { return maGraphic.IsSwapOut(); }
+
+ BOOL Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const GraphicAttr* pAttr = NULL, ULONG nFlags = GRFMGR_DRAW_STANDARD );
+
+ BOOL StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0L,
+ const GraphicAttr* pAttr = NULL, ULONG nFlags = GRFMGR_DRAW_STANDARD,
+ OutputDevice* pFirstFrameOutDev = NULL );
+
+ void StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L );
+
+ friend SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj );
+ friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj );
+};
+
+// ------------------
+// - GraphicManager -
+// ------------------
+
+class GraphicManager
+{
+ friend class GraphicObject;
+ friend class GraphicDisplayCacheEntry;
+
+private:
+
+ List maObjList;
+ GraphicCache* mpCache;
+
+ GraphicManager( const GraphicManager& rGraphicManager ) {}
+ GraphicManager& operator=( const GraphicManager& rGraphicManager ) { return *this; }
+
+#if __PRIVATE
+
+ BOOL ImplDraw( OutputDevice* pOut, const Point& rPt,
+ const Size& rSz, GraphicObject& rObj,
+ const GraphicAttr& rAttr, BOOL& rCached );
+
+ BOOL ImplCreateOutput( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const BitmapEx& rBmpEx, const GraphicAttr& rAttr,
+ BitmapEx* pBmpEx = NULL );
+ BOOL ImplCreateOutput( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const GDIMetaFile& rMtf, const GraphicAttr& rAttr,
+ GDIMetaFile* pMtf = NULL );
+
+ BOOL ImplCreateScaled( const BitmapEx& rBmpEx,
+ long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY,
+ long nStartX, long nEndX, long nStartY, long nEndY,
+ BitmapEx& rOutBmpEx );
+
+ BOOL ImplCreateRotatedScaled( const BitmapEx& rBmpEx,
+ USHORT nRot10, const Size& rOutSzPix, const Size& rUntSzPix,
+ long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY,
+ long nStartX, long nEndX, long nStartY, long nEndY,
+ BitmapEx& rOutBmpEx );
+
+ static void ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, ULONG nAdjustmentFlags );
+ static void ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, ULONG nAdjustmentFlags );
+ static void ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, ULONG nAdjustmentFlags );
+
+ static void ImplDraw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const BitmapEx& rBmpEx, const GraphicAttr& rAttr );
+ static void ImplDraw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const GDIMetaFile& rMtf, const GraphicAttr& rAttr );
+
+ // Only used by GraphicObject's Ctor's and Dtor's
+ void ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, const ByteString* pID );
+ void ImplUnregisterObj( const GraphicObject& rObj );
+ inline BOOL ImplHasObjects() const { return( maObjList.Count() > 0UL ); }
+
+ // Only used in swap case by GraphicObject
+ void ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj );
+ BOOL ImplFillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute );
+ void ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj );
+
+ ByteString ImplGetUniqueID( const GraphicObject& rObj ) const;
+
+#endif // __PRIVATE
+
+public:
+
+ GraphicManager( ULONG nCacheSize = 10000000UL, ULONG nMaxObjCacheSize = 2400000UL );
+ ~GraphicManager();
+
+ void SetMaxCacheSize( ULONG nNewCacheSize );
+ ULONG GetMaxCacheSize() const;
+
+ void SetMaxObjCacheSize( ULONG nNewMaxObjSize, BOOL bDestroyGreaterCached = FALSE );
+ ULONG GetMaxObjCacheSize() const;
+
+ ULONG GetUsedCacheSize() const;
+ ULONG GetFreeCacheSize() const;
+
+ void ClearCache();
+
+ void ReleaseFromCache( const GraphicObject& rObj );
+
+ BOOL IsInCache( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ const GraphicObject& rObj, const GraphicAttr& rAttr ) const;
+
+ BOOL DrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
+ GraphicObject& rObj, const GraphicAttr& rAttr,
+ const ULONG nFlags, BOOL& rCached );
+};
+
+#endif // _GRFMGR_HXX
diff --git a/goodies/inc/mailenum.hxx b/goodies/inc/mailenum.hxx
new file mode 100644
index 000000000000..ab1542256ca6
--- /dev/null
+++ b/goodies/inc/mailenum.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: mailenum.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _MAILENUM_HXX
+#define _MAILENUM_HXX
+
+// enum ------------------------------------------------------------------
+
+enum MailState
+{
+ MAIL_STATE_SUCCESS = 0,
+ MAIL_STATE_FAILURE,
+ MAIL_STATE_ATTACHED_NOT_FOUND,
+ MAIL_STATE_NO_MEMORY,
+ MAIL_STATE_LOGIN_FAILURE,
+ MAIL_STATE_RECEIVER_NOT_FOUND,
+ MAIL_STATE_TOO_MANY_FILES,
+ MAIL_STATE_TOO_MANY_RECEIVERS,
+ MAIL_STATE_NO_RECEIVERS,
+ MAIL_STATE_USER_CANCEL,
+ MAIL_STATE_DRIVER_NOT_AVAILABLE
+};
+
+enum MailDriver
+{
+ MAIL_DRIVER_DETECT = 0,
+ MAIL_DRIVER_BEGIN,
+ MAIL_DRIVER_VIM = MAIL_DRIVER_BEGIN,
+ MAIL_DRIVER_MAPI,
+ MAIL_DRIVER_CMC,
+ MAIL_DRIVER_SMP,
+ MAIL_DRIVER_UNIX,
+ MAIL_DRIVER_SMTP,
+ MAIL_DRIVER_END
+};
+
+enum MailPriority
+{
+ MAIL_PRIORITY_LOW = 0,
+ MAIL_PRIORITY_NORMAL,
+ MAIL_PRIORITY_URGENT
+};
+
+enum MailReceiverRole
+{
+ MAIL_RECEIVER_TO = 0,
+ MAIL_RECEIVER_CC,
+ MAIL_RECEIVER_BCC,
+ MAIL_RECEIVER_NEWSGROUP
+};
+
+enum MailAction
+{
+ MAIL_ACTION_DYING, // Server stirbt
+ MAIL_ACTION_SEND, // Mail wurde versendet
+ MAIL_ACTION_READ, // Mail wurde als gelesen gekennzeichnet
+ MAIL_ACTION_REMOVED, // Mail wurde gel"oscht
+ MAIL_ACTION_UPDATED, // alle Mails wurden neu eingelesen
+ MAIL_ACTION_NEXT, // Sprung zur n"achsten Mail
+ MAIL_ACTION_PREV // Sprung zur vorherigen Mail
+};
+
+// Textformat zum Versenden von Nachrichten ------------------------------
+
+#define TXTFORMAT_ASCII ((BYTE)0x01)
+#define TXTFORMAT_HTML ((BYTE)0x02)
+#define TXTFORMAT_RTF ((BYTE)0x04)
+#define TXTFORMAT_OFFICE ((BYTE)0x08)
+
+
+#endif
+
diff --git a/goodies/inc/vector3d.hxx b/goodies/inc/vector3d.hxx
new file mode 100644
index 000000000000..685a1c31051e
--- /dev/null
+++ b/goodies/inc/vector3d.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * $RCSfile: vector3d.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _SVX_VECTOR3D_HXX
+#define _SVX_VECTOR3D_HXX
+
+#ifndef _SOLAR_H
+#include
+#endif
+
+#ifndef _INC_MATH
+#include
+#endif
+
+class Point;
+class SvStream;
+
+/*************************************************************************
+|*
+|* 3D-Vektor
+|*
+\************************************************************************/
+
+class Vector3D
+{
+ protected:
+ double V[3];
+
+ public:
+ Vector3D(double fX = 0, double fY = 0, double fZ = 0)
+ { V[0] = fX; V[1] = fY; V[2] = fZ; }
+ Vector3D(const Point& rPnt, double fZ = 0);
+ const double& X() const { return V[0]; }
+ const double& Y() const { return V[1]; }
+ const double& Z() const { return V[2]; }
+ double& X() { return V[0]; }
+ double& Y() { return V[1]; }
+ double& Z() { return V[2]; }
+ const double& operator[] (int nPos) const { return V[nPos]; }
+ double& operator[] (int nPos) { return V[nPos]; }
+
+ double GetLength(void) const;
+ double GetXYLength(void) const;
+ double GetXZLength(void) const;
+ double GetYZLength(void) const;
+
+ void Normalize();
+ void Min(const Vector3D& rVec);
+ void Max(const Vector3D& rVec);
+ void Abs();
+
+ void CalcInBetween(const Vector3D& rOld1, const Vector3D& rOld2, double t);
+ void CalcMiddle(const Vector3D& rOld1, const Vector3D& rOld2);
+ void CalcMiddle(const Vector3D& rOld1, const Vector3D& rOld2, Vector3D& rOld3);
+
+ Vector3D GetPerpendicular2D() const;
+
+ Vector3D& operator+= (const Vector3D&);
+ Vector3D& operator-= (const Vector3D&);
+ Vector3D operator+ (const Vector3D&) const;
+ Vector3D operator- (const Vector3D&) const;
+ Vector3D operator- (void) const;
+
+ // Kreuzprodukt mittels operator| (wie: Senkrecht)
+ Vector3D& operator|= (const Vector3D&);
+ Vector3D operator| (const Vector3D&) const;
+
+ // Skalarprodukt als Methode, um Verwechslungen zu vermeiden
+ double Scalar(const Vector3D&) const;
+
+ Vector3D& operator/= (const Vector3D&);
+ Vector3D operator/ (const Vector3D&) const;
+ Vector3D& operator*= (const Vector3D&);
+ Vector3D operator* (const Vector3D&) const;
+
+ Vector3D& operator*= (double);
+ Vector3D operator* (double) const;
+ Vector3D& operator/= (double);
+ Vector3D operator/ (double) const;
+
+ BOOL operator== (const Vector3D&) const;
+ BOOL operator!= (const Vector3D&) const;
+
+ friend SvStream& operator>>(SvStream& rIStream, Vector3D&);
+ friend SvStream& operator<<(SvStream& rOStream, const Vector3D&);
+};
+
+#endif // _SVX_VECTOR3D_HXX
diff --git a/goodies/prj/d.lst b/goodies/prj/d.lst
new file mode 100644
index 000000000000..1d1aeba3e5e3
--- /dev/null
+++ b/goodies/prj/d.lst
@@ -0,0 +1,116 @@
+..\%__SRC%\lib\mail.lib %_DEST%\lib%_EXT%\mail.lib
+..\%__SRC%\lib\crypt.lib %_DEST%\lib%_EXT%\crypt.lib
+..\%__SRC%\lib\icrp.lib %_DEST%\lib%_EXT%\icrp.lib
+..\%__SRC%\lib\igo.lib %_DEST%\lib%_EXT%\go.lib
+..\%__SRC%\lib\igo.lib %_DEST%\lib%_EXT%\igo.lib
+..\%__SRC%\slb\go.lib %_DEST%\lib%_EXT%\xgo.lib
+..\%__SRC%\slb\gol.lib %_DEST%\lib%_EXT%\gol.lib
+..\%__SRC%\srs\mail.srs %_DEST%\res%_EXT%\mail.srs
+..\%__SRC%\srs\dialog.srs %_DEST%\res%_EXT%\godialog.srs
+..\%__SRC%\misc\goodies.hid %_DEST%\bin%_EXT%\goodies.hid
+..\%__SRC%\bin\ma?????.* %_DEST%\bin%_EXT%\ma?????.*
+..\%__SRC%\bin\tfu?????.dll %_DEST%\bin%_EXT%\tfu?????.dll
+..\%__SRC%\bin\tfu?????.sym %_DEST%\bin%_EXT%\tfu?????.sym
+..\%__SRC%\bin\crp?????.dll %_DEST%\bin%_EXT%\crp?????.dll
+..\%__SRC%\bin\crp?????.sym %_DEST%\bin%_EXT%\crp?????.sym
+..\%__SRC%\bin\solarvim.dll %_DEST%\bin%_EXT%\solarvim.dll
+..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
+..\%__SRC%\bin\ept%UPD%*.dll %_DEST%\bin%_EXT%\ept%UPD%*.dll
+..\%__SRC%\bin\ept%UPD%*.sym %_DEST%\bin%_EXT%\ept%UPD%*.sym
+..\%__SRC%\bin\eme%UPD%*.dll %_DEST%\bin%_EXT%\eme%UPD%*.dll
+..\%__SRC%\bin\eme%UPD%*.sym %_DEST%\bin%_EXT%\eme%UPD%*.sym
+..\%__SRC%\bin\egi%UPD%*.dll %_DEST%\bin%_EXT%\egi%UPD%*.dll
+..\%__SRC%\bin\egi%UPD%*.sym %_DEST%\bin%_EXT%\egi%UPD%*.sym
+..\%__SRC%\bin\epn%UPD%*.dll %_DEST%\bin%_EXT%\epn%UPD%*.dll
+..\%__SRC%\bin\epn%UPD%*.sym %_DEST%\bin%_EXT%\epn%UPD%*.sym
+..\%__SRC%\bin\eti%UPD%*.dll %_DEST%\bin%_EXT%\eti%UPD%*.dll
+..\%__SRC%\bin\eti%UPD%*.sym %_DEST%\bin%_EXT%\eti%UPD%*.sym
+..\%__SRC%\bin\ecg%UPD%*.dll %_DEST%\bin%_EXT%\ecg%UPD%*.dll
+..\%__SRC%\bin\ecg%UPD%*.sym %_DEST%\bin%_EXT%\ecg%UPD%*.sym
+..\%__SRC%\bin\era%UPD%*.dll %_DEST%\bin%_EXT%\era%UPD%*.dll
+..\%__SRC%\bin\era%UPD%*.sym %_DEST%\bin%_EXT%\era%UPD%*.sym
+..\%__SRC%\bin\eps%UPD%*.dll %_DEST%\bin%_EXT%\eps%UPD%*.dll
+..\%__SRC%\bin\eps%UPD%*.sym %_DEST%\bin%_EXT%\eps%UPD%*.sym
+..\%__SRC%\bin\exp%UPD%*.dll %_DEST%\bin%_EXT%\exp%UPD%*.dll
+..\%__SRC%\bin\exp%UPD%*.sym %_DEST%\bin%_EXT%\exp%UPD%*.sym
+..\%__SRC%\bin\epb%UPD%*.dll %_DEST%\bin%_EXT%\epb%UPD%*.dll
+..\%__SRC%\bin\epb%UPD%*.sym %_DEST%\bin%_EXT%\epb%UPD%*.sym
+..\%__SRC%\bin\epg%UPD%*.dll %_DEST%\bin%_EXT%\epg%UPD%*.dll
+..\%__SRC%\bin\epg%UPD%*.sym %_DEST%\bin%_EXT%\epg%UPD%*.sym
+..\%__SRC%\bin\epp%UPD%*.dll %_DEST%\bin%_EXT%\epp%UPD%*.dll
+..\%__SRC%\bin\epp%UPD%*.sym %_DEST%\bin%_EXT%\epp%UPD%*.sym
+..\%__SRC%\bin\ime%UPD%*.dll %_DEST%\bin%_EXT%\ime%UPD%*.dll
+..\%__SRC%\bin\ime%UPD%*.sym %_DEST%\bin%_EXT%\ime%UPD%*.sym
+..\%__SRC%\bin\ipt%UPD%*.dll %_DEST%\bin%_EXT%\ipt%UPD%*.dll
+..\%__SRC%\bin\ipt%UPD%*.sym %_DEST%\bin%_EXT%\ipt%UPD%*.sym
+..\%__SRC%\bin\icd%UPD%*.dll %_DEST%\bin%_EXT%\icd%UPD%*.dll
+..\%__SRC%\bin\icd%UPD%*.sym %_DEST%\bin%_EXT%\icd%UPD%*.sym
+..\%__SRC%\bin\ipx%UPD%*.dll %_DEST%\bin%_EXT%\ipx%UPD%*.dll
+..\%__SRC%\bin\ipx%UPD%*.sym %_DEST%\bin%_EXT%\ipx%UPD%*.sym
+..\%__SRC%\bin\icg%UPD%*.dll %_DEST%\bin%_EXT%\icg%UPD%*.dll
+..\%__SRC%\bin\icg%UPD%*.sym %_DEST%\bin%_EXT%\icg%UPD%*.sym
+..\%__SRC%\bin\ira%UPD%*.dll %_DEST%\bin%_EXT%\ira%UPD%*.dll
+..\%__SRC%\bin\ira%UPD%*.sym %_DEST%\bin%_EXT%\ira%UPD%*.sym
+..\%__SRC%\bin\itg%UPD%*.dll %_DEST%\bin%_EXT%\itg%UPD%*.dll
+..\%__SRC%\bin\itg%UPD%*.sym %_DEST%\bin%_EXT%\itg%UPD%*.sym
+..\%__SRC%\bin\ipd%UPD%*.dll %_DEST%\bin%_EXT%\ipd%UPD%*.dll
+..\%__SRC%\bin\ipd%UPD%*.sym %_DEST%\bin%_EXT%\ipd%UPD%*.sym
+..\%__SRC%\bin\ips%UPD%*.dll %_DEST%\bin%_EXT%\ips%UPD%*.dll
+..\%__SRC%\bin\ips%UPD%*.sym %_DEST%\bin%_EXT%\ips%UPD%*.sym
+..\%__SRC%\bin\ipb%UPD%*.dll %_DEST%\bin%_EXT%\ipb%UPD%*.dll
+..\%__SRC%\bin\ipb%UPD%*.sym %_DEST%\bin%_EXT%\ipb%UPD%*.sym
+..\%__SRC%\bin\iti%UPD%*.dll %_DEST%\bin%_EXT%\iti%UPD%*.dll
+..\%__SRC%\bin\iti%UPD%*.sym %_DEST%\bin%_EXT%\iti%UPD%*.sym
+..\%__SRC%\bin\igi%UPD%*.dll %_DEST%\bin%_EXT%\igi%UPD%*.dll
+..\%__SRC%\bin\igi%UPD%*.sym %_DEST%\bin%_EXT%\igi%UPD%*.sym
+..\%__SRC%\bin\idx%UPD%*.dll %_DEST%\bin%_EXT%\idx%UPD%*.dll
+..\%__SRC%\bin\idx%UPD%*.sym %_DEST%\bin%_EXT%\idx%UPD%*.sym
+..\%__SRC%\bin\ixb%UPD%*.dll %_DEST%\bin%_EXT%\ixb%UPD%*.dll
+..\%__SRC%\bin\ixb%UPD%*.sym %_DEST%\bin%_EXT%\ixb%UPD%*.sym
+..\%__SRC%\bin\jpg%UPD%*.dll %_DEST%\bin%_EXT%\jpg%UPD%*.dll
+..\%__SRC%\bin\jpg%UPD%*.sym %_DEST%\bin%_EXT%\jpg%UPD%*.sym
+..\%__SRC%\bin\go%UPD%*.dll %_DEST%\bin%_EXT%\go%UPD%*.dll
+..\%__SRC%\bin\go%UPD%*.sym %_DEST%\bin%_EXT%\go%UPD%*.sym
+..\%__SRC%\bin\gol%UPD%*.dll %_DEST%\bin%_EXT%\gol%UPD%*.dll
+..\%__SRC%\bin\gol%UPD%*.sym %_DEST%\bin%_EXT%\gol%UPD%*.sym
+
+..\%__SRC%\lib\lib*%UPD%*.* %_DEST%\lib%_EXT%\lib*%UPD%*.*
+..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+
+mkdir: %_DEST%\inc%_EXT%\goodies
+hedabu: ..\inc\grfmgr.hxx %_DEST%\inc%_EXT%\goodies\grfmgr.hxx
+hedabu: ..\inc\mailenum.hxx %_DEST%\inc%_EXT%\goodies\mailenum.hxx
+hedabu: ..\inc\mailbook.hxx %_DEST%\inc%_EXT%\goodies\mailbook.hxx
+hedabu: ..\inc\mailbody.hxx %_DEST%\inc%_EXT%\goodies\mailbody.hxx
+hedabu: ..\inc\mailsrv.hxx %_DEST%\inc%_EXT%\goodies\mailsrv.hxx
+hedabu: ..\inc\mailread.hxx %_DEST%\inc%_EXT%\goodies\mailread.hxx
+hedabu: ..\inc\mailbrw.hxx %_DEST%\inc%_EXT%\goodies\mailbrw.hxx
+hedabu: ..\inc\mailfmgr.hxx %_DEST%\inc%_EXT%\goodies\mailfmgr.hxx
+hedabu: ..\inc\maillog.hxx %_DEST%\inc%_EXT%\goodies\maillog.hxx
+hedabu: ..\inc\vector3d.hxx %_DEST%\inc%_EXT%\goodies\vector3d.hxx
+hedabu: ..\inc\point3d.hxx %_DEST%\inc%_EXT%\goodies\point3d.hxx
+hedabu: ..\inc\hmatrix.hxx %_DEST%\inc%_EXT%\goodies\hmatrix.hxx
+hedabu: ..\inc\matrix3d.hxx %_DEST%\inc%_EXT%\goodies\matrix3d.hxx
+hedabu: ..\inc\point4d.hxx %_DEST%\inc%_EXT%\goodies\point4d.hxx
+hedabu: ..\inc\base3d.hxx %_DEST%\inc%_EXT%\goodies\base3d.hxx
+hedabu: ..\inc\b3dlight.hxx %_DEST%\inc%_EXT%\goodies\b3dlight.hxx
+hedabu: ..\inc\vector3d.hxx %_DEST%\inc%_EXT%\goodies\vector3d.hxx
+hedabu: ..\inc\matril3d.hxx %_DEST%\inc%_EXT%\goodies\matril3d.hxx
+hedabu: ..\inc\bucket.hxx %_DEST%\inc%_EXT%\goodies\bucket.hxx
+hedabu: ..\inc\point3d.hxx %_DEST%\inc%_EXT%\goodies\point3d.hxx
+hedabu: ..\inc\b3dentty.hxx %_DEST%\inc%_EXT%\goodies\b3dentty.hxx
+hedabu: ..\inc\b3dcolor.hxx %_DEST%\inc%_EXT%\goodies\b3dcolor.hxx
+hedabu: ..\inc\b3dcompo.hxx %_DEST%\inc%_EXT%\goodies\b3dcompo.hxx
+hedabu: ..\inc\b3dtex.hxx %_DEST%\inc%_EXT%\goodies\b3dtex.hxx
+hedabu: ..\inc\b3dgeom.hxx %_DEST%\inc%_EXT%\goodies\b3dgeom.hxx
+hedabu: ..\inc\b3dvolum.hxx %_DEST%\inc%_EXT%\goodies\b3dvolum.hxx
+hedabu: ..\inc\b3dtrans.hxx %_DEST%\inc%_EXT%\goodies\b3dtrans.hxx
+hedabu: ..\inc\b2dmbase.hxx %_DEST%\inc%_EXT%\goodies\b2dmbase.hxx
+hedabu: ..\inc\b2dmbmp.hxx %_DEST%\inc%_EXT%\goodies\b2dmbmp.hxx
+hedabu: ..\inc\b2dmline.hxx %_DEST%\inc%_EXT%\goodies\b2dmline.hxx
+hedabu: ..\inc\b2dmpnt.hxx %_DEST%\inc%_EXT%\goodies\b2dmpnt.hxx
+hedabu: ..\inc\b2dmtri.hxx %_DEST%\inc%_EXT%\goodies\b2dmtri.hxx
+hedabu: ..\inc\bxdintpo.hxx %_DEST%\inc%_EXT%\goodies\bxdintpo.hxx
+hedabu: ..\inc\agsdkdll.hxx %_DEST%\inc%_EXT%\goodies\agsdkdll.hxx
+
diff --git a/goodies/source/base3d/b3dcolor.cxx b/goodies/source/base3d/b3dcolor.cxx
new file mode 100644
index 000000000000..8cb9b0087c94
--- /dev/null
+++ b/goodies/source/base3d/b3dcolor.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dcolor.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _B3D_B3DCOLOR_HXX
+#include "b3dcolor.hxx"
+#endif
+
+/*************************************************************************
+|*
+|* Farbwert interpolieren
+|*
+\************************************************************************/
+
+void B3dColor::CalcInBetween(Color& rOld1, Color& rOld2, double t)
+{
+ if(rOld1 != rOld2)
+ {
+ UINT16 nFac = (UINT16)(t * 256.0);
+ UINT16 nNegFac = 256 - nFac;
+ SetRed((UINT8)(((nFac * (UINT16)rOld2.GetRed())
+ + (nNegFac * (UINT16)rOld1.GetRed())) >> 8));
+ SetGreen((UINT8)(((nFac * (UINT16)rOld2.GetGreen())
+ + (nNegFac * (UINT16)rOld1.GetGreen())) >> 8));
+ SetBlue((UINT8)(((nFac * (UINT16)rOld2.GetBlue())
+ + (nNegFac * (UINT16)rOld1.GetBlue())) >> 8));
+ SetTransparency((UINT8)(((nFac * (UINT16)rOld2.GetTransparency())
+ + (nNegFac * (UINT16)rOld1.GetTransparency())) >> 8));
+ }
+ else
+ {
+ SetColor(rOld1.GetColor());
+ }
+}
+
+/*************************************************************************
+|*
+|* Farbwert Mittelwert finden mit 2 Farben
+|*
+\************************************************************************/
+
+void B3dColor::CalcMiddle(Color& rOld1, Color& rOld2)
+{
+ if(rOld1 != rOld2)
+ {
+ SetRed((UINT8)(((UINT16)rOld1.GetRed()
+ + (UINT16)rOld2.GetRed())>>1));
+ SetGreen((UINT8)(((UINT16)rOld1.GetGreen()
+ + (UINT16)rOld2.GetGreen())>>1));
+ SetBlue((UINT8)(((UINT16)rOld1.GetBlue()
+ + (UINT16)rOld2.GetBlue())>>1));
+ SetTransparency((UINT8)(((UINT16)rOld1.GetTransparency()
+ + (UINT16)rOld2.GetTransparency())>>1));
+ }
+ else
+ {
+ SetColor(rOld1.GetColor());
+ }
+}
+
+/*************************************************************************
+|*
+|* Farbwert Mittelwert finden mit 3 Farben
+|*
+\************************************************************************/
+
+void B3dColor::CalcMiddle(Color& rOld1, Color& rOld2, Color& rOld3)
+{
+ if(rOld1 != rOld2)
+ {
+ if(rOld1 != rOld3)
+ {
+ // alle 3 unterschiedlich
+ SetRed((UINT8)(((UINT16)rOld1.GetRed()
+ + (UINT16)rOld2.GetRed()
+ + (UINT16)rOld3.GetRed()) / 3L));
+ SetGreen((UINT8)(((UINT16)rOld1.GetGreen()
+ + (UINT16)rOld2.GetGreen()
+ + (UINT16)rOld3.GetGreen()) / 3L));
+ SetBlue((UINT8)(((UINT16)rOld1.GetBlue()
+ + (UINT16)rOld2.GetBlue()
+ + (UINT16)rOld3.GetBlue()) / 3L));
+ SetTransparency((UINT8)(((UINT16)rOld1.GetTransparency()
+ + (UINT16)rOld2.GetTransparency()
+ + (UINT16)rOld3.GetTransparency()) / 3L));
+ }
+ else
+ {
+ // 1 != 2, 1 == 3
+ CalcMiddle(rOld1, rOld2);
+ }
+ }
+ else
+ {
+ // 1 == 2
+ if(rOld1 != rOld3)
+ {
+ CalcMiddle(rOld1, rOld3);
+ }
+ else
+ {
+ // 1==2, 1==3 -> alle gleich
+ SetColor(rOld1.GetColor());
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Ermittle den Abstand der beiden Farben im Farbraum
+|* Dies geschieht OHNE Wurzelziehen, d.h. es wird als Metrik im RGB
+|* Farbraum hier das Quadrat der 'echten' (gewohnten) Entfernung benutzt
+|*
+\************************************************************************/
+
+ULONG B3dColor::GetDistance(Color& rOld)
+{
+ // Bei Gleichheit kein Abstand
+ if(*this == rOld)
+ return 0L;
+
+ // Abstand ermitteln
+ long nDistRed = rOld.GetRed() > GetRed() ?
+ rOld.GetRed() - GetRed() :
+ GetRed() - rOld.GetRed();
+ long nDistGreen = rOld.GetGreen() > GetGreen() ?
+ rOld.GetGreen() - GetGreen() :
+ GetGreen() - rOld.GetGreen();
+ long nDistBlue = rOld.GetBlue() > GetBlue() ?
+ rOld.GetBlue() - GetBlue() :
+ GetBlue() - rOld.GetBlue();
+ return (ULONG)(nDistRed * nDistRed
+ + nDistGreen * nDistGreen
+ + nDistBlue * nDistBlue);
+}
+
+/*************************************************************************
+|*
+|* Farbaddition mit clamping
+|*
+\************************************************************************/
+
+B3dColor& B3dColor::operator+= (const B3dColor& rCol)
+{
+ UINT16 nZwi;
+ if(rCol.GetRed())
+ {
+ nZwi = (UINT16)GetRed() + (UINT16)rCol.GetRed();
+ if(nZwi > 255)
+ nZwi = 255;
+ SetRed((UINT8)nZwi);
+ }
+ if(rCol.GetGreen())
+ {
+ nZwi = (UINT16)GetGreen() + (UINT16)rCol.GetGreen();
+ if(nZwi > 255)
+ nZwi = 255;
+ SetGreen((UINT8)nZwi);
+ }
+ if(rCol.GetBlue())
+ {
+ nZwi = (UINT16)GetBlue() + (UINT16)rCol.GetBlue();
+ if(nZwi > 255)
+ nZwi = 255;
+ SetBlue((UINT8)nZwi);
+ }
+ if(rCol.GetTransparency())
+ {
+ nZwi = (UINT16)GetTransparency() + (UINT16)rCol.GetTransparency();
+ if(nZwi > 255)
+ nZwi = 255;
+ SetTransparency((UINT8)nZwi);
+ }
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Farbsubtraktion mit clamping
+|*
+\************************************************************************/
+
+B3dColor& B3dColor::operator-= (const B3dColor& rCol)
+{
+ INT16 nZwi;
+ if(rCol.GetRed())
+ {
+ nZwi = (INT16)GetRed() - (INT16)rCol.GetRed();
+ if(nZwi < 0)
+ nZwi = 0;
+ SetRed((UINT8)nZwi);
+ }
+ if(rCol.GetGreen())
+ {
+ nZwi = (INT16)GetGreen() - (INT16)rCol.GetGreen();
+ if(nZwi < 0)
+ nZwi = 0;
+ SetGreen((UINT8)nZwi);
+ }
+ if(rCol.GetBlue())
+ {
+ nZwi = (INT16)GetBlue() - (INT16)rCol.GetBlue();
+ if(nZwi < 0)
+ nZwi = 0;
+ SetBlue((UINT8)nZwi);
+ }
+ if(rCol.GetTransparency())
+ {
+ nZwi = (INT16)GetTransparency() - (INT16)rCol.GetTransparency();
+ if(nZwi < 0)
+ nZwi = 0;
+ SetTransparency((UINT8)nZwi);
+ }
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Farbaddition mit clamping, neue Farbe erzeugen
+|*
+\************************************************************************/
+
+B3dColor B3dColor::operator+ (const B3dColor& rCol) const
+{
+ B3dColor aSum = *this;
+ aSum += rCol;
+ return aSum;
+}
+
+/*************************************************************************
+|*
+|* Farbsubtraktion mit clamping, neue Farbe erzeugen
+|*
+\************************************************************************/
+
+B3dColor B3dColor::operator- (const B3dColor& rCol) const
+{
+ B3dColor aSub = *this;
+ aSub -= rCol;
+ return aSub;
+}
+
+/*************************************************************************
+|*
+|* Farbmultiplikation, d.h. Gewichtung der Farben aneinander
+|*
+\************************************************************************/
+
+B3dColor& B3dColor::operator*= (const B3dColor& rCol)
+{
+ // urspruengliches Objekt ist die Farbe, rCol die zu berechnende
+ // Gewichtung
+ SetRed((UINT8)(((((UINT16)GetRed())+1)
+ * (UINT16)rCol.GetRed()) >> 8));
+ SetGreen((UINT8)(((((UINT16)GetGreen())+1)
+ * (UINT16)rCol.GetGreen()) >> 8));
+ SetBlue((UINT8)(((((UINT16)GetBlue())+1)
+ * (UINT16)rCol.GetBlue()) >> 8));
+ SetTransparency((UINT8)(((((UINT16)GetTransparency())+1)
+ * (UINT16)rCol.GetTransparency()) >> 8));
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Farbmultiplikation, neue Farbe erzeugen
+|*
+\************************************************************************/
+
+B3dColor B3dColor::operator* (const B3dColor& rCol) const
+{
+ B3dColor aMul = *this;
+ aMul *= rCol;
+ return aMul;
+}
+
+/*************************************************************************
+|*
+|* Farbmultiplikation mit Faktor im Bereich [0.0 .. 1.0]
+|*
+\************************************************************************/
+
+B3dColor& B3dColor::operator*= (const double fVal)
+{
+ ULONG nVal = (ULONG)(fVal * 65536.0);
+ SetRed((UINT8)(((ULONG)GetRed() * nVal) >> 16));
+ SetGreen((UINT8)(((ULONG)GetGreen() * nVal) >> 16));
+ SetBlue((UINT8)(((ULONG)GetBlue() * nVal) >> 16));
+ SetTransparency((UINT8)(((ULONG)GetTransparency() * nVal) >> 16));
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Farbmultiplikation mit Faktor, neue Farbe erzeugen
+|*
+\************************************************************************/
+
+B3dColor B3dColor::operator* (const double fVal) const
+{
+ B3dColor aMul = *this;
+ aMul *= fVal;
+ return aMul;
+}
+
diff --git a/goodies/source/base3d/b3dcommn.cxx b/goodies/source/base3d/b3dcommn.cxx
new file mode 100644
index 000000000000..759c8c2032ee
--- /dev/null
+++ b/goodies/source/base3d/b3dcommn.cxx
@@ -0,0 +1,1415 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dcommn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _B3D_B3DCOMMN_HXX
+#include "b3dcommn.hxx"
+#endif
+
+#ifndef _B3D_B3DTRANS_HXX
+#include "b3dtrans.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+
+#ifndef _SV_OUTDEV_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Bucket fuer Index
+|*
+\************************************************************************/
+
+BASE3D_IMPL_BUCKET(UINT32, Bucket)
+
+/*************************************************************************
+|*
+|* Konstruktor Base3DCommon
+|*
+\************************************************************************/
+
+Base3DCommon::Base3DCommon(OutputDevice* pOutDev)
+: Base3D(pOutDev),
+ aBuffers(12) // 4K
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor Base3DCommon
+|*
+\************************************************************************/
+
+Base3DCommon::~Base3DCommon()
+{
+}
+
+/*************************************************************************
+|*
+|* Start der Szenenbeschreibung:
+|*
+\************************************************************************/
+
+void Base3DCommon::StartScene()
+{
+}
+
+/*************************************************************************
+|*
+|* Ende der Szenenbeschreibung:
+|*
+\************************************************************************/
+
+void Base3DCommon::EndScene()
+{
+}
+
+/*************************************************************************
+|*
+|* Neuen freien Eintrag fuer naechste geometrische Daten liefern
+|*
+\************************************************************************/
+
+B3dEntity& Base3DCommon::ImplGetFreeEntity()
+{
+ aBuffers.Append();
+ return (aBuffers[aBuffers.Count() - 1]);
+}
+
+/*************************************************************************
+|*
+|* Beleuchtung setzen/lesen
+|*
+\************************************************************************/
+
+void Base3DCommon::SetLightGroup(B3dLightGroup* pSet, BOOL bSetGlobal)
+{
+ // call parent
+ Base3D::SetLightGroup(pSet, bSetGlobal);
+
+ if(GetLightGroup())
+ {
+ Matrix4D aOldObjectTrans;
+ Matrix4D aEmptyTrans;
+ if(GetTransformationSet() && bSetGlobal)
+ {
+ aOldObjectTrans = GetTransformationSet()->GetObjectTrans();
+ GetTransformationSet()->SetObjectTrans(aEmptyTrans);
+ }
+
+ for(UINT16 i=0;i
+ GetLightObject((Base3DLightNumber)(Base3DLight0 + i));
+ if(rLight.IsDirectionalSource())
+ {
+ Vector3D aDirection = rLight.GetPosition();
+ if(GetTransformationSet())
+ aDirection = GetTransformationSet()->InvTransObjectToEye(aDirection);
+ aDirection.Normalize();
+ rLight.SetPositionEye(aDirection);
+ }
+ else
+ {
+ Vector3D aPosition = rLight.GetPosition();
+ if(GetTransformationSet())
+ aPosition = GetTransformationSet()->ObjectToEyeCoor(aPosition);
+ rLight.SetPositionEye(aPosition);
+
+ Vector3D aDirection = rLight.GetSpotDirection();
+ if(GetTransformationSet())
+ aDirection = GetTransformationSet()->InvTransObjectToEye(aDirection);
+ aDirection.Normalize();
+ rLight.SetSpotDirectionEye(aDirection);
+ }
+ }
+
+ if(GetTransformationSet() && bSetGlobal)
+ GetTransformationSet()->SetObjectTrans(aOldObjectTrans);
+ }
+}
+
+/*************************************************************************
+|*
+|* entsprechend der impliziten Topologie auf den neuen Punkt reagieren
+|*
+\************************************************************************/
+
+void Base3DCommon::ImplPostAddVertex(B3dEntity& rEntity)
+{
+ B3dTransformationSet* pSet = GetTransformationSet();
+ if(pSet)
+ {
+ // Positionen transformieren in ClippingCoordinates
+ rEntity.Point() *= pSet->GetObjectToDevice();
+
+ // Normalen transformieren in EyeCoordinates
+ if((GetLightGroup() && GetLightGroup()->IsLightingEnabled()) && rEntity.IsNormalUsed())
+ {
+ if(GetForceFlat() || GetShadeModel() == Base3DFlat)
+ rEntity.Normal() = pSet->InvTransObjectToEye(rEntity.PlaneNormal());
+ else
+ rEntity.Normal() = pSet->InvTransObjectToEye(rEntity.Normal());
+ }
+
+ // Texturkoordinaten transformieren anhand der Texturmatrix
+ if(rEntity.IsTexCoorUsed())
+ {
+ // Multiplikation mittels Point4D, um die Translationen zu
+ // beruecksichtigen. Die Koordinaten werden bei GetVector3D()
+ // homogenisiert.
+ rEntity.TexCoor() = pSet->TransTextureCoor(rEntity.TexCoor());
+ }
+ }
+
+ // Aktuelle Farbe in diesen B3dEntity eintragen
+ rEntity.Color() = GetColor();
+
+ // Jetzt Topologie beachten und evtl. ein Primitiv ausspucken
+ UINT32 aCount = aBuffers.Count();
+ switch(GetObjectMode())
+ {
+ case Base3DPoints:
+ {
+ Create3DPoint(0);
+ aBuffers.Erase();
+ break;
+ }
+ case Base3DLines:
+ {
+ if(aCount == 2)
+ {
+ Create3DLine(0, 1);
+ aBuffers.Erase();
+ }
+ break;
+ }
+ case Base3DLineLoop:
+ case Base3DLineStrip:
+ {
+ if(aCount > 1)
+ Create3DLine(aCount - 2, aCount - 1);
+ break;
+ }
+ case Base3DTriangles:
+ {
+ if(aCount == 3)
+ {
+ Create3DTriangle(0, 1, 2);
+ aBuffers.Erase();
+ }
+ break;
+ }
+ case Base3DTriangleStrip:
+ {
+ if(aCount > 2)
+ {
+ if(aCount % 2)
+ Create3DTriangle(aCount - 3, aCount - 2, aCount - 1);
+ else
+ Create3DTriangle(aCount - 2, aCount - 3, aCount - 1);
+ }
+ break;
+ }
+ case Base3DTriangleFan:
+ {
+ if(aCount > 2)
+ Create3DTriangle(0, aCount - 2, aCount - 1);
+ break;
+ }
+ case Base3DQuads:
+ {
+ if(aCount == 4)
+ {
+ // Spezielle Behandlung, da die inneren Kanten
+ // eines Quads NICHT sichtbar sein sollen
+ B3dEntity& rEnt2 = aBuffers[2];
+ B3dEntity& rEnt0 = aBuffers[0];
+
+ BOOL bZwi = rEnt2.IsEdgeVisible();
+ rEnt2.SetEdgeVisible(FALSE);
+ Create3DTriangle(0, 1, 2);
+ rEnt2.SetEdgeVisible(bZwi);
+
+ bZwi = rEnt0.IsEdgeVisible();
+ rEnt0.SetEdgeVisible(FALSE);
+ Create3DTriangle(0, 2, 3);
+ rEnt0.SetEdgeVisible(bZwi);
+
+ aBuffers.Erase();
+ }
+ break;
+ }
+ case Base3DQuadStrip:
+ {
+ if(aCount > 2)
+ {
+ B3dEntity& rEnt = aBuffers[aCount - 2];
+ BOOL bZwi = rEnt.IsEdgeVisible();
+ rEnt.SetEdgeVisible(FALSE);
+ if(aCount % 2)
+ Create3DTriangle(aCount - 2, aCount - 1, aCount - 3);
+ else
+ Create3DTriangle(aCount - 3, aCount - 1, aCount - 2);
+ rEnt.SetEdgeVisible(bZwi);
+ }
+ break;
+ }
+ case Base3DPolygon:
+ {
+ if(aCount > 2)
+ {
+ B3dEntity& rEnt = aBuffers[aCount - 1];
+ BOOL bZwi = rEnt.IsEdgeVisible();
+ rEnt.SetEdgeVisible(FALSE);
+ Create3DTriangle(0, aCount - 2, aCount - 1);
+ rEnt.SetEdgeVisible(bZwi);
+ // Ab jetzt nie wieder eine Kante vom 1. Punkt (0)
+ // ausgehend generieren
+ if(aCount == 3)
+ aBuffers[0].SetEdgeVisible(FALSE);
+ }
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Ein neues Primitiv, leere die jetzigen buffer
+|*
+\************************************************************************/
+
+void Base3DCommon::ImplStartPrimitive()
+{
+ // Buffer leeren
+ aBuffers.Erase();
+}
+
+/*************************************************************************
+|*
+|* Primitiv abgeschlossen
+|*
+\************************************************************************/
+
+void Base3DCommon::ImplEndPrimitive()
+{
+ // Topologie beachten und evtl. ein Primitiv ausspucken
+ UINT32 aCount = aBuffers.Count();
+ switch(GetObjectMode())
+ {
+ case Base3DLineLoop:
+ {
+ if(aCount > 2)
+ Create3DLine(aCount - 1, 0);
+ break;
+ }
+ case Base3DPolygon:
+ {
+ // Letzte schliessende Linie erzeugen, falls
+ // es um das Erzeugen von Linien ging und
+ // das letzte Primitiv auch wirklich zur Ausgabe
+ // gelangt ist
+ if(GetRenderMode() == Base3DRenderLine
+ && !WasLastPrimitiveRejected())
+ {
+ if(aCount > 2)
+ Create3DLine(aCount - 1, 0);
+ }
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Funktion fuer Primitiv Punkt
+|* Clipping und Ausgabe, falls noch was ueber ist
+|*
+\************************************************************************/
+
+void Base3DCommon::Create3DPoint(UINT32 nInd)
+{
+ bLastPrimitiveRejected = TRUE;
+ if(GetRenderMode() != Base3DRenderNone)
+ {
+ // Sicherstellen, dass die Koordinaten in
+ // ClipCoordinates vorliegen
+ aBuffers[nInd].To3DCoor(GetTransformationSet());
+
+ // Punkt an Einheitswuerfel clippen
+ if(Clip3DPoint(nInd))
+ Create3DPointClipped(nInd);
+ }
+}
+
+void Base3DCommon::Create3DPointClipped(UINT32 nInd)
+{
+ // einige Beleuchtungsdinge koennen hier schon geklaert
+ // werden
+ if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
+ {
+ B3dEntity& rEnt = aBuffers[nInd];
+ if(rEnt.IsNormalUsed() && GetLightGroup())
+ {
+ // Beleuchtungsmodell loesen, Normale loeschen
+ SolveColorModel(rEnt.Color(), rEnt.Normal(), rEnt.Point().GetVector3D());
+ }
+ rEnt.SetNormalUsed(FALSE);
+ }
+
+ // Punkt wird dargestellt, weiterreichen
+ if(GetPointSize() != 1.0)
+ {
+ // Punkt als Kreis mit dem Durchmesser GetPointSize() ausgeben
+ // Hole den Original-Punkt
+ B3dEntity& rEnt1 = aBuffers[nInd];
+
+ // Umrechnen auf DeviceCoor
+ rEnt1.ToDeviceCoor(GetTransformationSet());
+
+ // Radius holen
+ // Logische Koordinaten nach Pixel
+ Point aPnt((long)(GetLineWidth() + 0.5), 0);
+ double fRadius = ((double)((
+ GetOutputDevice()->PixelToLogic(aPnt).X() -
+ GetOutputDevice()->PixelToLogic(Point()).X()) + 0.5)) / 2.0;
+
+ // Bereite neue Punkte vor
+ // Hole die neuen Punkte
+ UINT32 nNew1 = aBuffers.Count();
+ aBuffers.Append(rEnt1);
+ B3dEntity& rNew1 = aBuffers[nNew1];
+
+ UINT32 nNew2 = aBuffers.Count();
+ aBuffers.Append(rEnt1);
+ B3dEntity& rNew2 = aBuffers[nNew2];
+
+ UINT32 nNew3 = aBuffers.Count();
+ aBuffers.Append(rEnt1);
+ B3dEntity& rNew3 = aBuffers[nNew3];
+
+ // Schleife drehen
+ Base3DRenderMode eRenderMode = GetRenderMode();
+ SetRenderMode(Base3DRenderFill);
+ BOOL bPolyOffset = GetPolygonOffset(Base3DPolygonOffsetFill);
+ SetPolygonOffset(Base3DPolygonOffsetFill, TRUE);
+
+ for(double fWink=0.0;fWink nCount)
+ aBuffers.Remove();
+ }
+}
+
+void Base3DCommon::Create3DLineClipped(UINT32 nInd1, UINT32 nInd2)
+{
+ // einige Beleuchtungsdinge koennen hier schon geklaert
+ // werden
+ if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
+ {
+ if(GetShadeModel() == Base3DFlat)
+ {
+ // Beleuchtuungsmodell fuer gemittelte Normale
+ // loesen, Normalen loeschen
+ B3dEntity& rEnt1 = aBuffers[nInd1];
+ B3dEntity& rEnt2 = aBuffers[nInd2];
+ if(rEnt1.IsNormalUsed() && rEnt2.IsNormalUsed() && GetLightGroup())
+ {
+ Vector3D aNormal = rEnt1.Normal() + rEnt2.Normal();
+ aNormal.Normalize();
+ Vector3D aPoint = (rEnt1.Point().GetVector3D() + rEnt2.Point().GetVector3D()) / 2.0;
+ SolveColorModel(rEnt1.Color(), aNormal, aPoint);
+ rEnt2.Color() = rEnt1.Color();
+ }
+ rEnt1.SetNormalUsed(FALSE);
+ rEnt2.SetNormalUsed(FALSE);
+ }
+ }
+ else
+ {
+ if(GetShadeModel() == Base3DFlat)
+ {
+ B3dEntity& rEnt1 = aBuffers[nInd1];
+ B3dEntity& rEnt2 = aBuffers[nInd2];
+ B3dColor aCol;
+ aCol.CalcMiddle(rEnt1.Color(), rEnt2.Color());
+ rEnt1.Color() = aCol;
+ rEnt2.Color() = aCol;
+ }
+ }
+
+ if(GetRenderMode() == Base3DRenderPoint)
+ {
+ // Als Punkte ausgeben
+ Create3DPointClipped(nInd1);
+ Create3DPointClipped(nInd2);
+ }
+ else
+ {
+ if(GetLineWidth() != 1.0)
+ {
+ // Linie als Polygon mit der Breite GetLineWidth() ausgeben
+ // Hole die Original-Punkte
+ B3dEntity& rEnt1 = aBuffers[nInd1];
+ B3dEntity& rEnt2 = aBuffers[nInd2];
+
+ // Umrechnen auf DeviceCoor
+ rEnt1.ToDeviceCoor(GetTransformationSet());
+ rEnt2.ToDeviceCoor(GetTransformationSet());
+
+ // Bereite neue Punkte vor
+ // Hole die neuen Punkte
+ UINT32 nNew1 = aBuffers.Count();
+ aBuffers.Append(rEnt1);
+ B3dEntity& rNew1 = aBuffers[nNew1];
+
+ UINT32 nNew2 = aBuffers.Count();
+ aBuffers.Append(rEnt1);
+ B3dEntity& rNew2 = aBuffers[nNew2];
+
+ UINT32 nNew3 = aBuffers.Count();
+ aBuffers.Append(rEnt2);
+ B3dEntity& rNew3 = aBuffers[nNew3];
+
+ UINT32 nNew4 = aBuffers.Count();
+ aBuffers.Append(rEnt2);
+ B3dEntity& rNew4 = aBuffers[nNew4];
+
+ // Berechnen
+ Vector3D aEntVector = rEnt2.Point().GetVector3D() - rEnt1.Point().GetVector3D();
+ Vector3D aTurned(-aEntVector.Y(), aEntVector.X(), 0.0);
+ aTurned.Normalize();
+
+ // Logische Koordinaten nach Pixel
+ Point aPnt((long)(GetLineWidth() + 0.5), 0);
+ double fFac = ((double)((
+ GetOutputDevice()->PixelToLogic(aPnt).X() -
+ GetOutputDevice()->PixelToLogic(Point()).X()) + 0.5)) / 2.0;
+
+ // Aufmuliplizieren
+ aTurned *= fFac;
+
+ rNew1.Point().X() += aTurned.X();
+ rNew1.Point().Y() += aTurned.Y();
+ rNew2.Point().X() -= aTurned.X();
+ rNew2.Point().Y() -= aTurned.Y();
+
+ rNew3.Point().X() += aTurned.X();
+ rNew3.Point().Y() += aTurned.Y();
+ rNew4.Point().X() -= aTurned.X();
+ rNew4.Point().Y() -= aTurned.Y();
+
+ // Ausgeben
+ Base3DRenderMode eRenderMode = GetRenderMode();
+ SetRenderMode(Base3DRenderFill);
+ BOOL bPolyOffset = GetPolygonOffset(Base3DPolygonOffsetFill);
+ SetPolygonOffset(Base3DPolygonOffsetFill, TRUE);
+
+ Create3DTriangle(nNew2, nNew1, nNew3);
+ Create3DTriangle(nNew2, nNew3, nNew4);
+
+ SetRenderMode(eRenderMode);
+ SetPolygonOffset(Base3DPolygonOffsetFill, bPolyOffset);
+
+ bLastPrimitiveRejected = FALSE;
+ }
+ else
+ {
+ // Linie ausgeben
+ Clipped3DLine(nInd1,nInd2);
+ bLastPrimitiveRejected = FALSE;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Funktion fuer Primitiv Dreieck
+|* Clipping und Ausgabe, falls noch was ueber ist
+|*
+\************************************************************************/
+
+void Base3DCommon::Create3DTriangle(UINT32 nInd1, UINT32 nInd2, UINT32 nInd3)
+{
+ bLastPrimitiveRejected = TRUE;
+
+ // Sicherstellen, dass die Koordinaten in
+ // ClipCoordinates vorliegen
+ aBuffers[nInd1].To3DCoor(GetTransformationSet());
+ aBuffers[nInd2].To3DCoor(GetTransformationSet());
+ aBuffers[nInd3].To3DCoor(GetTransformationSet());
+
+ if(AreEqual(nInd1, nInd2)
+ || AreEqual(nInd1, nInd3)
+ || AreEqual(nInd2, nInd3))
+ return;
+
+ // Normale vorbereiten, die echte Ebenennormale der Geometrie
+ // im Device-Koordinatensystem. Verzerrungen durch perspektivische
+ // Projektion sind somit bereits beruecksichtigt.
+ const Vector3D& rPnt1 = aBuffers[nInd1].Point().GetVector3D();
+ const Vector3D& rPnt2 = aBuffers[nInd2].Point().GetVector3D();
+ const Vector3D& rPnt3 = aBuffers[nInd3].Point().GetVector3D();
+ Vector3D aNormal = (rPnt2 - rPnt3)|(rPnt2 - rPnt1);
+ aNormal.Normalize();
+
+ if(GetCullMode() != Base3DCullNone)
+ {
+ // Normale ermitteln, eventuell gar nicht zeichnen
+ if(GetCullMode() == Base3DCullFront)
+ {
+ if(aNormal.Z() > 0.0)
+ return;
+ }
+ else
+ {
+ if(aNormal.Z() < 0.0)
+ return;
+ }
+ }
+
+ // allgemeines Polygon vorbereiten
+ UINT32Bucket aEdgeIndex(8);
+ aEdgeIndex.Append(nInd1);
+ aEdgeIndex.Append(nInd2);
+ aEdgeIndex.Append(nInd3);
+
+ // Alte Buffergroesse merken
+ ULONG nCount = aBuffers.Count();
+
+ // Dreieck an Einheitswuerfel clippen
+ if(Clip3DPolygon(aEdgeIndex))
+ {
+ UINT32 nNumPoints = aEdgeIndex.Count();
+
+ // einige Beleuchtungsdinge koennen hier schon geklaert
+ // werden
+ if(GetLightGroup() && GetLightGroup()->IsLightingEnabled() && nNumPoints != 0)
+ {
+ if(GetShadeModel() == Base3DFlat)
+ {
+ B3dEntity& rEnt = aBuffers[nInd1];
+ B3dColor aColFlatMode;
+
+ // #63505#
+ aNormal.X() = -aNormal.X();
+ aNormal.Y() = -aNormal.Y();
+
+ SolveColorModel(aColFlatMode, aNormal, rEnt.Point().GetVector3D());
+
+ // Vorberechnete Farbe in Eckpunkten setzen
+ for(UINT32 i=0;iGetModelTwoSide()))
+ eMat = Base3DMaterialBack;
+ Base3DRenderMode eMode = GetRenderMode(eMat);
+
+ if(eMode == Base3DRenderPoint)
+ {
+ // Als Punktmenge ausgeben
+ for(UINT32 i=0;i 2)
+ {
+ for(UINT32 i=2;i < nNumPoints; i++)
+ {
+ Clipped3DTriangle(
+ aEdgeIndex[0],
+ aEdgeIndex[i-1],
+ aEdgeIndex[i]);
+ bLastPrimitiveRejected = FALSE;
+ }
+ }
+ }
+ }
+ // Alte Buffergroesse wiederherstellen, um fortgesetzte
+ // Primitive nicht zu zerstoeren
+ while(aBuffers.Count() > nCount)
+ aBuffers.Remove();
+}
+
+/*************************************************************************
+|*
+|* Punkt am canonical view volume clippen
+|*
+\************************************************************************/
+
+BOOL Base3DCommon::Clip3DPoint(UINT32 nInd)
+{
+ return (!(BOOL)GetClipFlags(nInd));
+}
+
+/*************************************************************************
+|*
+|* Vergleicht, ob die beiden Entities geometrisch gleich sind
+|*
+\************************************************************************/
+
+BOOL Base3DCommon::AreEqual(UINT32 nInd1, UINT32 nInd2)
+{
+ const Vector3D& rVec1 = aBuffers[nInd1].Point().GetVector3D();
+ const Vector3D& rVec2 = aBuffers[nInd2].Point().GetVector3D();
+
+ if(fabs(rVec1.X() - rVec2.X()) < SMALL_DVALUE)
+ if(fabs(rVec1.Y() - rVec2.Y()) < SMALL_DVALUE)
+ if(fabs(rVec1.Z() - rVec2.Z()) < SMALL_DVALUE)
+ return TRUE;
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Linie am canonical view volume clippen
+|*
+\************************************************************************/
+
+BOOL Base3DCommon::Clip3DLine(UINT32& nInd1,UINT32& nInd2)
+{
+ UINT16 nFlag0, nFlag1;
+ do
+ {
+ nFlag0 = GetClipFlags(nInd1);
+ nFlag1 = GetClipFlags(nInd2);
+
+ // Beide Endpunkte drin?
+ if(!(nFlag0 | nFlag1))
+ return TRUE;
+
+ // Linie komplett draussen?
+ if(nFlag0 & nFlag1)
+ return FALSE;
+
+ // Es muss geclippt werden, bereite einen neuen Punkt vor
+ UINT32 nNewIndex = aBuffers.Count();
+ aBuffers.Append();
+
+ if((nFlag0 | nFlag1) & (CLIPFLAG_FRONT | CLIPFLAG_BACK))
+ {
+ // clippen in Z
+ if(nFlag0 & (CLIPFLAG_FRONT | CLIPFLAG_BACK))
+ {
+ if(nFlag0 & CLIPFLAG_FRONT)
+ CalcNewPoint(nNewIndex, nInd2, nInd1, 2, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nInd1, nInd2, 2, 1.0);
+ nInd1 = nNewIndex;
+ }
+ else
+ {
+ if(nFlag1 & CLIPFLAG_FRONT)
+ CalcNewPoint(nNewIndex, nInd1, nInd2, 2, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nInd2, nInd1, 2, 1.0);
+ nInd2 = nNewIndex;
+ }
+ }
+ else if((nFlag0 | nFlag1) & (CLIPFLAG_LEFT | CLIPFLAG_RIGHT))
+ {
+ // clippen in X
+ if(nFlag0 & (CLIPFLAG_LEFT | CLIPFLAG_RIGHT))
+ {
+ if(nFlag0 & CLIPFLAG_LEFT)
+ CalcNewPoint(nNewIndex, nInd2, nInd1, 0, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nInd1, nInd2, 0, 1.0);
+ nInd1 = nNewIndex;
+ }
+ else
+ {
+ if(nFlag1 & CLIPFLAG_LEFT)
+ CalcNewPoint(nNewIndex, nInd1, nInd2, 0, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nInd2, nInd1, 0, 1.0);
+ nInd2 = nNewIndex;
+ }
+ }
+ else
+ {
+ // clippen in Y
+ if(nFlag0 & (CLIPFLAG_BOTTOM | CLIPFLAG_TOP))
+ {
+ if(nFlag0 & CLIPFLAG_BOTTOM)
+ CalcNewPoint(nNewIndex, nInd2, nInd1, 1, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nInd1, nInd2, 1, 1.0);
+ nInd1 = nNewIndex;
+ }
+ else
+ {
+ if(nFlag1 & CLIPFLAG_BOTTOM)
+ CalcNewPoint(nNewIndex, nInd1, nInd2, 1, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nInd2, nInd1, 1, 1.0);
+ nInd2 = nNewIndex;
+ }
+ }
+ } while(nFlag0 | nFlag1);
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* ClipFlags eines Punktes ermitteln und zurueckgeben
+|*
+\************************************************************************/
+
+UINT16 Base3DCommon::GetClipFlags(UINT32 nInd)
+{
+ UINT16 nRetval(0);
+ Point4D& rPoint = aBuffers[nInd].Point();
+ rPoint.Homogenize();
+
+ if(rPoint[0] < -(1.0 + SMALL_DVALUE))
+ nRetval |= CLIPFLAG_LEFT;
+ if(rPoint[0] > 1.0 + SMALL_DVALUE)
+ nRetval |= CLIPFLAG_RIGHT;
+
+ if(rPoint[1] < -(1.0 + SMALL_DVALUE))
+ nRetval |= CLIPFLAG_BOTTOM;
+ if(rPoint[1] > 1.0 + SMALL_DVALUE)
+ nRetval |= CLIPFLAG_TOP;
+
+ if(rPoint[2] < -(1.0 + SMALL_DVALUE))
+ nRetval |= CLIPFLAG_FRONT;
+ if(rPoint[2] > 1.0 + SMALL_DVALUE)
+ nRetval |= CLIPFLAG_BACK;
+
+ return nRetval;
+}
+
+/*************************************************************************
+|*
+|* Dreieck am canonical view volume clippen
+|* Ergebnis steht indirekt ueber eine Indizierungstabelle in
+|* aEdgeIndex[nEdgeDestination][0 .. aEdgeIndexFree[nEdgeDestination]]
+|*
+\************************************************************************/
+
+BOOL Base3DCommon::Clip3DPolygon(UINT32Bucket& rEdgeIndex)
+{
+ UINT32 i;
+ UINT16 nAllFlagsOr, nAllFlagsAnd;
+
+ do
+ {
+ // ClipFlags holen
+ nAllFlagsOr = 0;
+ nAllFlagsAnd = CLIPFLAG_ALL;
+
+ for(i=0; i < rEdgeIndex.Count(); i++)
+ {
+ UINT16 nFlag = GetClipFlags(rEdgeIndex[i]);
+ nAllFlagsOr |= nFlag;
+ nAllFlagsAnd &= nFlag;
+ }
+
+ // Alle Endpunkte drin?
+ if(!nAllFlagsOr)
+ return TRUE;
+
+ // Dreieck komplett draussen?
+ if(nAllFlagsAnd)
+ return FALSE;
+
+ if(nAllFlagsOr & (CLIPFLAG_FRONT|CLIPFLAG_BACK))
+ {
+ // clippen in Z
+ if(nAllFlagsOr & CLIPFLAG_FRONT)
+ {
+ ClipPoly(rEdgeIndex, 2, TRUE);
+ }
+ else
+ {
+ ClipPoly(rEdgeIndex, 2, FALSE);
+ }
+ }
+ else if(nAllFlagsOr & (CLIPFLAG_LEFT|CLIPFLAG_RIGHT))
+ {
+ // clippen in X
+ if(nAllFlagsOr & CLIPFLAG_LEFT)
+ {
+ ClipPoly(rEdgeIndex, 0, TRUE);
+ }
+ else
+ {
+ ClipPoly(rEdgeIndex, 0, FALSE);
+ }
+ }
+ else
+ {
+ // clippen in Y
+ if(nAllFlagsOr & CLIPFLAG_BOTTOM)
+ {
+ ClipPoly(rEdgeIndex, 1, TRUE);
+ }
+ else
+ {
+ ClipPoly(rEdgeIndex, 1, FALSE);
+ }
+ }
+ } while(nAllFlagsOr);
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Testen, ob die Entitaet nInd innerhalb des canonical view volume liegt
+|*
+\************************************************************************/
+
+BOOL Base3DCommon::IsInside(UINT32 nInd, UINT32 nDim, BOOL bLow)
+{
+ B3dEntity& aEntity = aBuffers[nInd];
+ if(bLow)
+ {
+ if(aEntity.Point()[nDim] < -1.0)
+ return FALSE;
+ }
+ else
+ {
+ if(aEntity.Point()[nDim] > 1.0)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Macht einen Clippingdurchgang eines Polygons in der angegebenen
+|* Dimension. Es werden eventuell neue Punkte erzeugt.
+|*
+\************************************************************************/
+
+void Base3DCommon::ClipPoly(UINT32Bucket& rEdgeIndex, UINT16 nDim, BOOL bLow)
+{
+ UINT32 nNumEdges = rEdgeIndex.Count();
+ UINT32 nCurrentInd = rEdgeIndex[0];
+ BOOL bCurrentInside = IsInside(nCurrentInd, nDim, bLow);
+ UINT32 nNextInd;
+ BOOL bNextInside;
+ UINT32Bucket aEdgeIndex(8);
+
+ for(UINT32 i=0;i draussen
+ // Platz fuer Schnittpunkt allokieren
+ UINT32 nNewIndex = aBuffers.Count();
+ aBuffers.Append();
+
+ // Schnittpunkt berechnen
+ if(bLow)
+ CalcNewPoint(nNewIndex, nCurrentInd, nNextInd, nDim, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nNextInd, nCurrentInd, nDim, 1.0);
+
+ // EdgeFlag behandeln, beim Verlassen zuruecksetzen
+ if(aBuffers[nCurrentInd].IsEdgeVisible())
+ aBuffers[nNewIndex].SetEdgeVisible(FALSE);
+
+ // Schnittpunkt hinzufuegen
+ aEdgeIndex.Append(nNewIndex);
+ }
+ }
+ else
+ {
+ if(bNextInside)
+ {
+ // draussen -> drin
+ // Platz fuer Schnittpunkt allokieren
+ UINT32 nNewIndex = aBuffers.Count();
+ aBuffers.Append();
+
+ // Schnittpunkt berechnen
+ if(bLow)
+ CalcNewPoint(nNewIndex, nNextInd, nCurrentInd, nDim, -1.0);
+ else
+ CalcNewPoint(nNewIndex, nCurrentInd, nNextInd, nDim, 1.0);
+
+ // EdgeFlag behandeln, selber Wert wie Vorgaenger
+ aBuffers[nNewIndex].SetEdgeVisible(aBuffers[nCurrentInd].IsEdgeVisible());
+
+ // Schnittpunkt hinzufuegen
+ aEdgeIndex.Append(nNewIndex);
+ }
+ }
+
+ // bereite naechste Kante vor
+ nCurrentInd = nNextInd;
+ bCurrentInside = bNextInside;
+ }
+
+ // Indices kopieren
+ rEdgeIndex = aEdgeIndex;
+}
+
+/*************************************************************************
+|*
+|* Die Entitaet nNew muss berechnet werden in der angegebenen
+|* Dimension an der Grenze fBound.
+|*
+\************************************************************************/
+
+void Base3DCommon::CalcNewPoint(UINT32 nNew, UINT32 nHigh, UINT32 nLow,
+ UINT16 nDim, double fBound)
+{
+ B3dEntity& aNew = aBuffers[nNew];
+ B3dEntity& aHigh = aBuffers[nHigh];
+ B3dEntity& aLow = aBuffers[nLow];
+ aNew.Reset();
+
+ double fFactor = 1.0;
+ if(aLow.Point()[nDim] != aHigh.Point()[nDim])
+ fFactor = (fBound - aHigh.Point()[nDim])
+ / (aLow.Point()[nDim] - aHigh.Point()[nDim]);
+
+#ifdef DBG_UTIL
+ if(fFactor > 1.0 || fFactor < 0.0)
+ DBG_ERROR("Wrong clipping factor (out of range)!");
+ if(fFactor == 1.0 || fFactor == 0.0)
+ DBG_ERROR("Wrong clipping factor (on boundary)!");
+#endif
+
+ // Neuen Punkt berechnen, aber Reihenfolge der
+ // Punkte aufrecht erhalten um die Sichtbarkeit
+ // der Kanten zu retten
+ aLow.ForceEqualBase(GetTransformationSet(), aHigh);
+ if(fBound < 0.0)
+ aNew.CalcInBetween(aLow, aHigh, 1.0 - fFactor);
+ else
+ aNew.CalcInBetween(aHigh, aLow, fFactor);
+
+ // WICHTIG fuer die Numerik beim Clippen: Die betroffene
+ // Koordinate wirklich auf fBound setzen, nicht berechnen.
+ // Beim Berechnen koennen nur wieder Ungenauigkeiten auftreten,
+ // die bei der Bestimmung der Clipping-Grenzen zu
+ // Endlosschleifen fuehren koennen.
+ aNew.Point()[nDim] = fBound;
+}
+
+/*************************************************************************
+|*
+|* Beleuchtungsmodell (ColorModel) in einem Punkt loesen
+|* Dabei das Ergebnis in rCol ablegen, d.h. wirklich modifizieren
+|*
+\************************************************************************/
+
+void Base3DCommon::SolveColorModel(B3dColor& rCol, Vector3D& rVec,
+ const Vector3D& rPnt)
+{
+ if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
+ {
+ B3dMaterial& rMat = GetMaterialObject();
+ BOOL bDoSolve(TRUE);
+
+ // Welches Material? Zeigt der Vektor vom Betrachter
+ // weg oder auf diesen?
+ if(rVec.Z() < 0.0)
+ {
+ // Rueckseite, soll diese dargestellt werden?
+ if(GetLightGroup() && GetLightGroup()->GetModelTwoSide())
+ {
+ rMat = GetMaterialObject(Base3DMaterialBack);
+ }
+ else
+ {
+ bDoSolve = FALSE;
+ }
+ }
+ if(bDoSolve)
+ rCol = SolveColorModel(rMat, rVec, rPnt);
+ }
+}
+
+B3dColor Base3DCommon::SolveColorModel(B3dMaterial& rMat, Vector3D& rVec, const Vector3D& rPnt)
+{
+ // Material emission einbeziehen
+ B3dColor aNew = rMat.GetMaterial(Base3DMaterialEmission);
+
+ // global ambient light beachten
+ aNew += (B3dColor)rMat.GetMaterial(Base3DMaterialAmbient)
+ * (B3dColor)GetLightGroup()->GetGlobalAmbientLight();
+
+ if(GetTransformationSet())
+ {
+ // Die Punktkoordinate liegt in ClipCoordinates vor, wird
+ // aber zur Farbberechnung in EyeCoordinates benoetigt.
+ // Fuehre eine Ruecktransformation durch.
+ Vector3D aPnt(rPnt);
+ aPnt = GetTransformationSet()->DeviceToEyeCoor(aPnt);
+
+ // Falls die Normale vom Betrachter weg zeigt und das Beleuchtungs-
+ // modell doppelseitig ist, Normale umdrehen
+ Vector3D aVec(rVec);
+ if(rVec.Z() < 0.0 && GetLightGroup()->GetModelTwoSide())
+ aVec = -rVec;
+
+ // Die einzelnen Lichtquellen einbeziehen
+ for(UINT16 i=Base3DLight0; i <= Base3DLight7; i++)
+ {
+ if(GetLightGroup()->IsEnabled((Base3DLightNumber)i))
+ {
+ aNew += SolveColorModel(
+ GetLightGroup()->GetLightObject((Base3DLightNumber)i),
+ rMat, aVec, aPnt);
+ }
+ }
+
+ // Transparenz aus der Diffuse (=Objekt-) Farbe uebernehmen
+ aNew.SetTransparency(rMat.GetMaterial(Base3DMaterialDiffuse).GetTransparency());
+ }
+ return aNew;
+}
+
+/*************************************************************************
+|*
+|* Beleuchtungsmodell (ColorModel) fuer eine Lichtquelle loesen
+|*
+\************************************************************************/
+
+B3dColor Base3DCommon::SolveColorModel(B3dLight& rLight, B3dMaterial& rMat,
+ Vector3D& rVec, const Vector3D& rPnt)
+{
+ B3dColor aRetval(255, 0, 0, 0);
+ if(rLight.IsEnabled())
+ {
+ // Faktor mit Attenuation 1.0 initialisieren, falls
+ // IsDirectionalSource() == TRUE
+ double fFac = 1.0;
+ Vector3D aLightToVertex;
+ BOOL bLightToVertex(FALSE);
+
+ if(!rLight.IsDirectionalSource())
+ {
+ // positional light
+ // echten attenuation Faktor ermitteln
+ fFac = rLight.GetConstantAttenuation();
+ if(rLight.IsLinearOrQuadratic())
+ {
+ // jetzt wird die Entfernung zwischen Lichtposition
+ // und Punkt benoetigt
+ aLightToVertex = rPnt - rLight.GetPositionEye();
+ bLightToVertex = TRUE;
+ double fLen = aLightToVertex.GetLength();
+ aLightToVertex.Normalize();
+
+ fFac += rLight.GetLinearAttenuation() * fLen;
+ fFac += rLight.GetQuadraticAttenuation() * fLen * fLen;
+ }
+ // Kehrwert bilden
+ if(fFac != 1.0 && fFac != 0.0)
+ fFac = 1.0 / fFac;
+
+ if(rLight.IsSpot())
+ {
+ // Spotlight it immer ein positional light
+ // Spotlight effect, wird auf den Faktor multipliziert
+ if(!bLightToVertex)
+ {
+ aLightToVertex = rPnt - rLight.GetPositionEye();
+ aLightToVertex.Normalize();
+ bLightToVertex = TRUE;
+ }
+ double fCosAngle = aLightToVertex.Scalar(rLight.GetSpotDirection());
+ // innerhalb des konus?
+ if(fCosAngle <= rLight.GetCosSpotCutoff())
+ {
+ if(fCosAngle > 0.000001)
+ {
+ if(rLight.GetSpotExponent() != 0.0)
+ fCosAngle = pow(fCosAngle, rLight.GetSpotExponent());
+ fFac *= fCosAngle;
+ }
+ else
+ {
+ fFac = 0.0;
+ }
+ }
+ else
+ {
+ // Ausserhalb des Konus, keine Beleuchtung
+ fFac = 0.0;
+ }
+ }
+ }
+
+ // falls es etwas zu beleuchten gibt...
+ if(fFac != 0.0)
+ {
+ // Ambient term
+ if(rLight.IsAmbient())
+ {
+ aRetval += (B3dColor)rLight.GetIntensity(Base3DMaterialAmbient)
+ * (B3dColor)rMat.GetMaterial(Base3DMaterialAmbient);
+ }
+
+ if(rLight.IsDiffuse() || rLight.IsSpecular())
+ {
+ if(bLightToVertex)
+ {
+ // Falls hier schon berechnet, handelt es sich
+ // auch um ein positional light
+ aLightToVertex = -aLightToVertex;
+ }
+ else
+ {
+ if(rLight.IsDirectionalSource())
+ {
+ // Vektor direkt nehmen
+ aLightToVertex = rLight.GetPosition();
+ }
+ else
+ {
+ // Umgerechnete Lichtposition nehmen
+ aLightToVertex = rLight.GetPositionEye();
+ // Betrachtete Position abziehen -> Einheitsvektor
+ // vom Punkt zur Lichtquelle
+ aLightToVertex -= rPnt;
+ }
+ aLightToVertex.Normalize();
+ }
+ double fCosFac = aLightToVertex.Scalar(rVec);
+
+ if(fCosFac > 0.000001)
+ {
+ if(rLight.IsDiffuse())
+ {
+ // Diffuse term
+ aRetval += (B3dColor)rLight.GetIntensity(Base3DMaterialDiffuse)
+ * (B3dColor)rMat.GetMaterial(Base3DMaterialDiffuse)
+ * fCosFac;
+ }
+ if(rLight.IsSpecular())
+ {
+ // Specular term
+ if(GetLightGroup()->GetLocalViewer())
+ {
+ // use vector 0,0,1
+ aLightToVertex.Z() += 1.0;
+ }
+ else
+ {
+ // vector Vertex to Viewpoint berechnen in
+ // Augkoordinaten, ist 0 - rPnt
+ aLightToVertex -= rPnt;
+ }
+ aLightToVertex.Normalize();
+ fCosFac = aLightToVertex.Scalar(rVec);
+ if(fCosFac > 0.000001)
+ {
+ if(rMat.GetShininess())
+ fCosFac = pow(fCosFac, rMat.GetShininess());
+ aRetval += (B3dColor)rLight.GetIntensity(Base3DMaterialSpecular)
+ * (B3dColor)rMat.GetMaterial(Base3DMaterialSpecular)
+ * fCosFac;
+ }
+ }
+ }
+ }
+
+ // jetzt fFac aufrechnen
+ if(fFac != 1.0)
+ aRetval *= fFac;
+ }
+ }
+ return aRetval;
+}
+
+
diff --git a/goodies/source/base3d/b3dcommn.hxx b/goodies/source/base3d/b3dcommn.hxx
new file mode 100644
index 000000000000..300c84e6cf21
--- /dev/null
+++ b/goodies/source/base3d/b3dcommn.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dcommn.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DCOMMN_HXX
+#define _B3D_B3DCOMMN_HXX
+
+#ifndef _B3D_BASE3D_HXX
+#include "base3d.hxx"
+#endif
+
+#ifndef _B3D_B3DGEOM_HXX
+#include "b3dgeom.hxx"
+#endif
+
+// Defines fuer clipping flags (nFlag0,1)
+#define CLIPFLAG_LEFT 0x0001
+#define CLIPFLAG_RIGHT 0x0002
+#define CLIPFLAG_BOTTOM 0x0004
+#define CLIPFLAG_TOP 0x0008
+#define CLIPFLAG_FRONT 0x0010
+#define CLIPFLAG_BACK 0x0020
+#define CLIPFLAG_ALL (CLIPFLAG_LEFT|CLIPFLAG_RIGHT| \
+ CLIPFLAG_BOTTOM|CLIPFLAG_TOP| \
+ CLIPFLAG_FRONT|CLIPFLAG_BACK)
+
+/*************************************************************************
+|*
+|* Bucket fuer Indices
+|*
+\************************************************************************/
+
+BASE3D_DECL_BUCKET(UINT32, Bucket)
+
+/*************************************************************************
+|*
+|* Die Basisklasse fuer Standard 3D Ausgaben auf StarView Basis
+|*
+\************************************************************************/
+
+#define BUFFER_OVERHEAD (20)
+
+class Base3DCommon : public Base3D
+{
+protected:
+ // Buffers fuer temporaere geometrische Daten
+ B3dEntityBucket aBuffers;
+
+ // Remember if last primitive was rejected
+ BOOL bLastPrimitiveRejected : 1;
+
+public:
+ Base3DCommon(OutputDevice* pOutDev);
+ virtual ~Base3DCommon();
+
+ // Beleuchtung setzen/lesen
+ virtual void SetLightGroup(B3dLightGroup* pSet, BOOL bSetGlobal=TRUE);
+
+ // Info if last primitive was rejected
+ BOOL WasLastPrimitiveRejected()
+ { return bLastPrimitiveRejected; }
+
+ // Szenenverwaltung
+ virtual void StartScene();
+ virtual void EndScene();
+
+protected:
+ // Geometrische Daten uebergeben
+ virtual B3dEntity& ImplGetFreeEntity();
+
+ virtual void ImplStartPrimitive();
+ virtual void ImplEndPrimitive();
+ virtual void ImplPostAddVertex(B3dEntity& rEnt);
+
+ void Create3DPoint(UINT32 nInd);
+ void Create3DPointClipped(UINT32 nInd);
+ void Create3DLine(UINT32 nInd1, UINT32 nInd2);
+ void Create3DLineClipped(UINT32 nInd1, UINT32 nInd2);
+ void Create3DTriangle(UINT32 nInd1, UINT32 nInd2, UINT32 nInd3);
+
+ virtual void Clipped3DPoint(UINT32 nInd) = 0;
+ virtual void Clipped3DLine(UINT32 nInd1,UINT32 nInd2) = 0;
+ virtual void Clipped3DTriangle(UINT32 nInd1,UINT32 nInd2, UINT32 nInd3) = 0;
+
+ // clipping functions
+ BOOL AreEqual(UINT32 nInd1, UINT32 nInd2);
+ BOOL Clip3DPoint(UINT32 nInd);
+ BOOL Clip3DLine(UINT32& nInd1,UINT32& nInd2);
+ BOOL Clip3DPolygon(UINT32Bucket& rEdgeIndex);
+ UINT16 GetClipFlags(UINT32 nInd);
+ BOOL IsInside(UINT32 nInd, UINT32 nDim, BOOL bLow);
+ void ClipPoly(UINT32Bucket& rEdgeIndex, UINT16 nDim,BOOL bLow);
+ void CalcNewPoint(UINT32 nNew,UINT32 nHigh,UINT32 nLow,
+ UINT16 nDim, double fBound);
+
+ // Beleuchtungsmodell (ColorModel) in einem Punkt loesen
+ // Punkt MUSS in ClipCoordinates vorliegen !
+ void SolveColorModel(B3dColor&, Vector3D&, const Vector3D&);
+ B3dColor SolveColorModel(B3dMaterial& rMat, Vector3D& rVec,
+ const Vector3D& rPnt);
+
+ // Beleuchtungsmodell (ColorModel) fuer eine Lichtquelle loesen
+ B3dColor SolveColorModel(B3dLight& rLight, B3dMaterial& rMat,
+ Vector3D& rVec, const Vector3D& rPnt);
+};
+
+
+#endif // _B3D_B3DCOMMN_HXX
diff --git a/goodies/source/base3d/b3dcompo.cxx b/goodies/source/base3d/b3dcompo.cxx
new file mode 100644
index 000000000000..2b8094a28581
--- /dev/null
+++ b/goodies/source/base3d/b3dcompo.cxx
@@ -0,0 +1,1180 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dcompo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DCOMPO_HXX
+#include "b3dcompo.hxx"
+#endif
+
+#ifndef _B3D_BASE3D_HXX
+#include "base3d.hxx"
+#endif
+
+#ifndef _B3D_B3DGEOM_HXX
+#include "b3dgeom.hxx"
+#endif
+
+#ifndef _INC_FLOAT
+#include
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Vergleiche fuer doubles mit bound
+|*
+\************************************************************************/
+
+#define DOUBLE_EQUAL(a,b) (fabs(a-b) < SMALL_DVALUE)
+#define DOUBLE_NOT_EQUAL(a,b) (fabs(a-b) > SMALL_DVALUE)
+#define DOUBLE_SMALLER(a,b) ((a + (SMALL_DVALUE / 2.0)) < b)
+#define DOUBLE_BIGGER(a,b) ((a - (SMALL_DVALUE / 2.0)) > b)
+
+/*************************************************************************
+|*
+|* Bucket fuer Kantenliste, vertikaler Teil
+|*
+\************************************************************************/
+
+BASE3D_IMPL_BUCKET(B3dEdgeList, Bucket)
+
+/*************************************************************************
+|*
+|* Bucket fuer Kantenliste, horizontaler Teil
+|*
+\************************************************************************/
+
+BASE3D_IMPL_BUCKET(B3dEdgeEntry, Bucket)
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+B3dComplexPolygon::B3dComplexPolygon()
+: aEntityBuffer(14), // 16K
+ aEdgeList(12), // 4K
+ aEdgeEntry(12) // 4K
+{
+ EmptyBuffers();
+ bTestForCut = TRUE;
+ nHighestEdge = 0L;
+ pBase3D = NULL;
+ pGeometry = NULL;
+ pLastVertex = NULL;
+}
+
+/*************************************************************************
+|*
+|* Gib einen neuen freien Eintrag zurueck
+|*
+\************************************************************************/
+
+B3dEntity &B3dComplexPolygon::GetFreeEntity()
+{
+ aEntityBuffer.Append();
+ return aEntityBuffer[aEntityBuffer.Count() - 1];
+}
+
+/*************************************************************************
+|*
+|* Ein neuer Punkt ist ausgefuellt
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::PostAddVertex(B3dEntity &rVertex)
+{
+ if(pLastVertex)
+ {
+ if(ArePointsEqual(*pLastVertex, rVertex))
+ {
+ aEntityBuffer.Remove();
+ return;
+ }
+ if(!nNewPolyStart)
+ {
+ if(nHighestEdge)
+ TestHighestEdge(rVertex);
+ else
+ nHighestEdge = aEntityBuffer.Count();
+ }
+ }
+
+ // Zeiger auf letzten hinzugefuegten Punkt setzen
+ pLastVertex = &rVertex;
+}
+
+/*************************************************************************
+|*
+|* Testet, ob die neue Edge in allen Freiheitsgraden groesser ist
+|* als die momentane
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::TestHighestEdge(B3dEntity& rVertex)
+{
+ B3dEntity& rHighest = aEntityBuffer[nHighestEdge - 1];
+ if(rVertex.GetX() <= rHighest.GetX())
+ {
+ if(rVertex.GetX() < rHighest.GetX())
+ {
+ nHighestEdge = aEntityBuffer.Count();
+ }
+ else
+ {
+ if(rVertex.GetY() <= rHighest.GetY())
+ {
+ if(rVertex.GetY() < rHighest.GetY())
+ {
+ nHighestEdge = aEntityBuffer.Count();
+ }
+ else
+ {
+ if(rVertex.GetZ() < rHighest.GetZ())
+ {
+ nHighestEdge = aEntityBuffer.Count();
+ }
+ }
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Vergleicht zwei Punkte auf ihren INHALT
+|* und fuellt die 2D-Koordinaten aus
+|*
+\************************************************************************/
+
+BOOL B3dComplexPolygon::ArePointsEqual(B3dEntity& rFirst,
+ B3dEntity& rSecond)
+{
+ // Wenn der Punkt dem letzten gleich ist, gar nicht behandeln
+ if(rFirst.Point().GetVector3D() == rSecond.Point().GetVector3D())
+ return TRUE;
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Alles auf Startzustand, buffer leeren
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::EmptyBuffers()
+{
+ aEntityBuffer.Erase();
+ nNewPolyStart = 0;
+ bOrientationValid = FALSE;
+ bNormalValid = FALSE;
+
+ // EdgeList und EdgeEntries leeren
+ pEdgeList = NULL;
+ aEdgeList.Erase();
+ aEdgeEntry.Erase();
+}
+
+/*************************************************************************
+|*
+|* Neues Teilpolygon beginnen
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::StartPrimitive()
+{
+ // Bisherige Punkte verarbeiten
+ if(aEntityBuffer.Count() > nNewPolyStart)
+ ComputeLastPolygon();
+
+ // Zeiger auf letzten Punkt loeschen
+ pLastVertex = NULL;
+
+ // Hoechten Punkt vergesset
+ nHighestEdge = 0L;
+}
+
+/*************************************************************************
+|*
+|* Teilpolygon abschliessen
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::ComputeLastPolygon(BOOL bIsLast)
+{
+ // Letzten Punkt mit erstem vergleichen, evtl
+ // wegschmeissen
+ if(pLastVertex)
+ {
+ if(ArePointsEqual(aEntityBuffer[nNewPolyStart], *pLastVertex))
+ {
+ // HighestEdge korrigieren, falls dieser geloescht werden soll
+ if(nHighestEdge && nHighestEdge == aEntityBuffer.Count())
+ nHighestEdge = nNewPolyStart + 1;
+
+ aEntityBuffer.Remove();
+ }
+ }
+
+ // Sind noch genug Punkte da?
+ if(aEntityBuffer.Count() < nNewPolyStart + 3)
+ {
+ // Geometrie ausgeben, obwohl zuwenig Punkte fuer ein Polygon
+ if(pBase3D)
+ {
+ pBase3D->StartPrimitive(Base3DPolygon);
+ for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
+ {
+ pBase3D->SetEdgeFlag(aEntityBuffer[a].IsEdgeVisible());
+ pBase3D->AddVertex(aEntityBuffer[a]);
+ }
+ pBase3D->EndPrimitive();
+ }
+ else if(pGeometry)
+ {
+ pGeometry->StartComplexPrimitive();
+ for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
+ pGeometry->AddComplexVertex(aEntityBuffer[a], aEntityBuffer[a].IsEdgeVisible());
+ pGeometry->EndComplexPrimitive();
+ }
+ }
+ else
+ {
+ if(!nNewPolyStart && bIsLast && IsConvexPolygon())
+ {
+ // Falls das PolyPolygon nur aus einem Polygon besteht
+ // und es Konvex ist, ist man fertig.
+ // Um die Qualitaet zu verbessern, wird fuer
+ // Polygone ab einer gewissen Punktzahl ein
+ // abschliessender Mittelpunkt generiert.
+ if(pBase3D)
+ {
+ pBase3D->StartPrimitive(Base3DPolygon);
+ if(aEntityBuffer.Count() > 4)
+ {
+ B3dEntity aNew;
+ aNew.CalcMiddle(aEntityBuffer[0], aEntityBuffer[aEntityBuffer.Count() / 2]);
+ pBase3D->SetEdgeFlag(FALSE);
+ pBase3D->AddVertex(aNew);
+ for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
+ {
+ pBase3D->SetEdgeFlag(aEntityBuffer[a].IsEdgeVisible());
+ pBase3D->AddVertex(aEntityBuffer[a]);
+ }
+ pBase3D->SetEdgeFlag(FALSE);
+ pBase3D->AddVertex(aEntityBuffer[0]);
+ }
+ else
+ {
+ for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
+ {
+ pBase3D->SetEdgeFlag(aEntityBuffer[a].IsEdgeVisible());
+ pBase3D->AddVertex(aEntityBuffer[a]);
+ }
+ }
+ pBase3D->EndPrimitive();
+ }
+ else if(pGeometry)
+ {
+ pGeometry->StartComplexPrimitive();
+ if(aEntityBuffer.Count() > 4)
+ {
+ B3dEntity aNew;
+ aNew.CalcMiddle(aEntityBuffer[0], aEntityBuffer[aEntityBuffer.Count() / 2]);
+ pGeometry->AddComplexVertex(aNew, FALSE);
+ for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
+ pGeometry->AddComplexVertex(aEntityBuffer[a], aEntityBuffer[a].IsEdgeVisible());
+ pGeometry->AddComplexVertex(aEntityBuffer[0], FALSE);
+ }
+ else
+ {
+ for(UINT32 a=0; a < aEntityBuffer.Count(); a++)
+ pGeometry->AddComplexVertex(aEntityBuffer[a], aEntityBuffer[a].IsEdgeVisible());
+ }
+ pGeometry->EndComplexPrimitive();
+ }
+ }
+ else
+ {
+ if(!bNormalValid)
+ ChooseNormal();
+
+ // Einsortieren
+ UINT32 nUpperBound = aEntityBuffer.Count();
+
+ // Als Polygon behandeln
+ if(GetTestForCut())
+ {
+ UINT32 a;
+ for(a=nNewPolyStart + 1; a < nUpperBound; a++)
+ AddEdgeCut(&aEntityBuffer[a-1], &aEntityBuffer[a]);
+
+ // Polygon schliessen
+ AddEdgeCut(&aEntityBuffer[a-1], &aEntityBuffer[nNewPolyStart]);
+ }
+ else
+ {
+ UINT32 a;
+ for(a=nNewPolyStart + 1; a < nUpperBound; a++)
+ AddEdge(&aEntityBuffer[a-1], &aEntityBuffer[a]);
+
+ // Polygon schliessen
+ AddEdge(&aEntityBuffer[a-1], &aEntityBuffer[nNewPolyStart]);
+ }
+
+ // Hier setzen, da evtl. bereits neue Punkte
+ // durch Schnitte hinzugekommen sind
+ nNewPolyStart = aEntityBuffer.Count();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Orientierung des ersten Polygons ermitteln
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::ChooseNormal()
+{
+ if(nHighestEdge)
+ {
+ UINT32 nHigh = nHighestEdge - 1;
+ UINT32 nPrev = (nHigh != 0) ? nHigh - 1 : aEntityBuffer.Count() - 1;
+ UINT32 nNext = (nHigh + 1 != aEntityBuffer.Count()) ? nHigh + 1 : nNewPolyStart;
+
+ // Punkt, Vorgaenger und Nachfolger holen
+ const Vector3D& rHigh = aEntityBuffer[nHigh].Point().GetVector3D();
+ const Vector3D& rPrev = aEntityBuffer[nPrev].Point().GetVector3D();
+ const Vector3D& rNext = aEntityBuffer[nNext].Point().GetVector3D();
+
+ // Normale bilden
+ aNormal = (rPrev - rHigh)|(rNext - rHigh);
+ if(aNormal != Vector3D())
+ aNormal.Normalize();
+ else
+ aNormal = Vector3D(0.0, 0.0, -1.0);
+ }
+ bNormalValid = TRUE;
+}
+
+/*************************************************************************
+|*
+|* Komplexes Polygon ausgeben
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::EndPrimitive(Base3D* pB3D)
+{
+ // Funktionszeiger setzen
+ pBase3D = pB3D;
+
+ // Letztes angefangenes Poly verarbeiten
+ ComputeLastPolygon(TRUE);
+
+ // Wenn es Kanten gibt
+ if(pEdgeList)
+ {
+ // Dreiecke generieren und ausgeben
+ pBase3D->StartPrimitive(Base3DTriangles);
+ while(pEdgeList)
+ ExtractTriangle();
+ pBase3D->EndPrimitive();
+ }
+
+ // Buffer leeren
+ EmptyBuffers();
+
+ // Zeiger wieder loeschen
+ pBase3D = NULL;
+}
+
+void B3dComplexPolygon::EndPrimitive(B3dGeometry *pGeom)
+{
+ // Funktionszeiger setzen
+ pGeometry = pGeom;
+
+ // Letztes angefangenes Poly verarbeiten
+ ComputeLastPolygon(TRUE);
+
+ // Dreiecke generieren und ausgeben
+ while(pEdgeList)
+ ExtractTriangle();
+
+ // Buffer leeren
+ EmptyBuffers();
+
+ // Zeiger wieder loeschen
+ pGeometry = NULL;
+}
+
+/*************************************************************************
+|*
+|* Teste aktuelles Polygon (0..aEntityBuffer.Count()) auf Konvexitaet
+|*
+\************************************************************************/
+
+BOOL B3dComplexPolygon::IsConvexPolygon()
+{
+ B3dEntity* pFirst = &aEntityBuffer[aEntityBuffer.Count() - 2];
+ B3dEntity* pSecond = &aEntityBuffer[aEntityBuffer.Count() - 1];
+ B3dEntity* pThird = &aEntityBuffer[0];
+ BOOL bDirection = IsLeft(pSecond, pFirst, pThird);
+ BOOL bOrder = CompareOrder(pSecond, pThird);
+ UINT16 nDirChanges(0);
+
+ for(UINT32 a = 1; nDirChanges <= 2 && a < aEntityBuffer.Count(); a++)
+ {
+ pFirst = pSecond;
+ pSecond = pThird;
+ pThird = &aEntityBuffer[a];
+
+ if(IsLeft(pSecond, pFirst, pThird) != bDirection)
+ return FALSE;
+
+ if(CompareOrder(pSecond, pThird) != bOrder)
+ {
+ nDirChanges++;
+ bOrder = !bOrder;
+ }
+ }
+ // Zuviele aenderungen der Ordnung, auf keinen Fall Convex
+ if(nDirChanges > 2)
+ return FALSE;
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Lexikografische Ordnung der beiden Punkte
+|*
+\************************************************************************/
+
+BOOL B3dComplexPolygon::CompareOrder(B3dEntity* pFirst, B3dEntity* pSecond)
+{
+ if(pFirst->GetX() < pSecond->GetX())
+ return FALSE;
+ if(pFirst->GetX() > pSecond->GetX())
+ return TRUE;
+ if(pFirst->GetY() < pSecond->GetY())
+ return FALSE;
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Teste, ob die Punkte der Kante getauscht werden muessen
+|*
+\************************************************************************/
+
+BOOL B3dComplexPolygon::DoSwap(B3dEntity* pStart, B3dEntity* pEnd)
+{
+ if(DOUBLE_EQUAL(pStart->GetY(), pEnd->GetY()))
+ {
+ if(pStart->GetX() > pEnd->GetX())
+ return TRUE;
+ }
+ else
+ {
+ if(pStart->GetY() > pEnd->GetY())
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Kante nInd1, nInd2 zu Kantenliste hinzufuegen
+|*
+\************************************************************************/
+
+B3dEdgeEntry* B3dComplexPolygon::AddEdge(B3dEntity* pStart, B3dEntity* pEnd)
+{
+ if(DoSwap(pStart, pEnd))
+ return InsertEdge(GetList(pEnd), pStart, TRUE);
+ return InsertEdge(GetList(pStart), pEnd, TRUE);
+}
+
+/*************************************************************************
+|*
+|* Einen Listeneintrag suchen oder neu anlegen
+|* Liefert immer einen Listeneintrag zurueck
+|*
+\************************************************************************/
+
+B3dEdgeList* B3dComplexPolygon::GetList(B3dEntity* pStart)
+{
+ B3dEdgeList* pList = pEdgeList;
+ B3dEdgeList* pLast = NULL;
+
+ while(pList && pList->GetStart() != pStart && DoSwap(pStart, pList->GetStart()))
+ {
+ pLast = pList;
+ pList = pList->GetDown();
+ }
+
+ if(pList)
+ {
+ if(pList->GetStart() != pStart)
+ {
+ if(DOUBLE_NOT_EQUAL(pStart->GetX(), pList->GetXPos()) || DOUBLE_NOT_EQUAL(pStart->GetY(), pList->GetYPos()))
+ {
+ // Auf jeden Fall ein neuer Eintrag
+ aEdgeList.Append();
+ B3dEdgeList* pNewList = &aEdgeList[aEdgeList.Count() - 1];
+ pNewList->Reset();
+ pNewList->SetStart(pStart);
+
+ // vor pList einhaengen
+ // pLast KANN NULL SEIN!
+ pNewList->SetDown(pList);
+ pList->SetParent(pNewList);
+ if(pLast)
+ {
+ pNewList->SetParent(pLast);
+ pLast->SetDown(pNewList);
+ }
+ else
+ {
+ pEdgeList = pNewList;
+ }
+
+ // Returnwert setzen
+ pList = pNewList;
+ }
+ else
+ {
+ // pList->GetStart() != pStart, aber
+ // die Koordinaten sind praktisch identisch!
+ // Gib diese Liste zurueck, d.h.
+ // tue gar nichts
+ }
+ }
+ }
+ else
+ {
+ // pLast->GetYPos() < pStart->GetY(),
+ // Hinten anhaengen
+ aEdgeList.Append();
+ pList = &aEdgeList[aEdgeList.Count() - 1];
+ pList->Reset();
+ pList->SetStart(pStart);
+ if(pLast)
+ {
+ pList->SetParent(pLast);
+ pLast->SetDown(pList);
+ }
+ else
+ {
+ pEdgeList = pList;
+ }
+ }
+ return pList;
+}
+
+/*************************************************************************
+|*
+|* Eine Kante in eine Kantenliste einsortieren
+|* Die Kante wird dabei neu erzeugt
+|*
+\************************************************************************/
+
+B3dEdgeEntry* B3dComplexPolygon::InsertEdge(B3dEdgeList* pList,
+ B3dEntity* pEnd, BOOL bEdgeVisible)
+{
+ B3dEdgeEntry* pEntry = pList->GetEntries();
+
+ // Immer ein neuer Eintrag
+ aEdgeEntry.Append();
+ B3dEdgeEntry* pNewEntry = &aEdgeEntry[aEdgeEntry.Count() - 1];
+ pNewEntry->Reset();
+ pNewEntry->SetEnd(pEnd);
+ pNewEntry->SetParent(pList);
+ pNewEntry->SetEdgeVisible(bEdgeVisible);
+
+ if(pEntry)
+ {
+ B3dEdgeEntry* pLast = NULL;
+ double fSlant = GetSlant(pNewEntry);
+ while(pEntry
+ && GetSlant(pEntry) < fSlant)
+ {
+ pLast = pEntry;
+ pEntry = pEntry->GetRight();
+ }
+
+ if(pEntry)
+ {
+ // GetSlant(pEntry) < fSlant
+ // GetSlant(pLast) >= fSlant
+ // Neuen Eintrag hinter pLast einfuegen
+ // pLast KANN NULL SEIN!
+ pNewEntry->SetRight(pEntry);
+ if(pLast)
+ {
+ pLast->SetRight(pNewEntry);
+ }
+ else
+ {
+ pList->SetEntries(pNewEntry);
+ }
+ }
+ else
+ {
+ // GetSlant(pEntry) >= fSlant
+ // Neuen Eintrag am Ende anhaengen
+ pLast->SetRight(pNewEntry);
+ }
+ }
+ else
+ {
+ pList->SetEntries(pNewEntry);
+ }
+ // Returnwert
+ return pNewEntry;
+}
+
+/*************************************************************************
+|*
+|* Steigung der Kante liefern
+|*
+\************************************************************************/
+
+double B3dComplexPolygon::GetSlant(B3dEdgeEntry* pEdge)
+{
+ double fDivisor = pEdge->GetYPos() - pEdge->GetParent()->GetYPos();
+ if(fabs(fDivisor) < SMALL_DVALUE)
+ return DBL_MAX;
+ return (pEdge->GetXPos() - pEdge->GetParent()->GetXPos()) / fDivisor;
+}
+
+/*************************************************************************
+|*
+|* Auf Schnitt mit einer vorhandenen Kante testen
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::TestForCut(B3dEdgeEntry* pEntry)
+{
+ // pEntry: die bereits eingefuegte neue Kante, die mit allen
+ // aelteren Kanten geschnitten werden soll
+ B3dEdgeList* pList = pEdgeList;
+
+ while(pList && DOUBLE_SMALLER(pList->GetYPos(), pEntry->GetYPos()))
+ {
+ // nur in Gruppen mit anderem Startpunkt suchen
+ if(pList != pEntry->GetParent())
+ {
+ B3dEdgeEntry* pTestEntry = pList->GetEntries();
+
+ while(pTestEntry)
+ {
+ if(DOUBLE_BIGGER(pTestEntry->GetYPos(), pEntry->GetParent()->GetYPos()))
+ {
+ // es existiert eine vertikale Bereichsueberschneidung
+ // Min/Max fuer pEntry holen
+ double fXMin = pEntry->GetXPos();
+ double fXMax = pEntry->GetParent()->GetXPos();
+ if(fXMin > fXMax)
+ {
+ double fSwap = fXMin;
+ fXMin = fXMax;
+ fXMax = fSwap;
+ }
+
+ // Min/Max in X fuer Kandidat holen
+ double fTestXMin = pTestEntry->GetXPos();
+ double fTestXMax = pList->GetXPos();
+ if(fTestXMin > fTestXMax)
+ {
+ double fSwap = fTestXMin;
+ fTestXMin = fTestXMax;
+ fTestXMax = fSwap;
+ }
+
+ if(fTestXMin < fXMax && fTestXMax > fXMin)
+ {
+ // es existiert eine horizontale Bereichsueberschneidung
+ // ein Schnitt ist moeglich
+ double fCut = FindCut(pEntry, pTestEntry);
+
+ if(fCut != 0.0)
+ {
+ // Schnitt existiert! fCut ist aus dem Parameterbereich
+ // der ersten Kante, also pEntry. Neuen Punkt erzeugen.
+ B3dEntity& rNew = GetFreeEntity();
+ rNew.CalcInBetween(*pEntry->GetParent()->GetStart(), *pEntry->GetEnd(), fCut);
+
+ // Neuen Punkt und neue von diesem ausgehende Kanten erzeugen
+ B3dEdgeList* pNewPointList = GetList(&rNew);
+ B3dEdgeEntry* pEntry2 = InsertEdge(pNewPointList, pEntry->GetEnd(), pEntry->IsEdgeVisible());
+ InsertEdge(pNewPointList, pTestEntry->GetEnd(), pTestEntry->IsEdgeVisible());
+
+ // Beteiligte Entries kuerzen
+ pEntry->SetEnd(&rNew);
+ pTestEntry->SetEnd(&rNew);
+
+ // Das neue Ende von pEntry kann weitere Linien
+ // schneiden, also geht der test mit diesem weiter
+ TestForCut(pEntry2);
+
+ // Test mit gekuerztem pEntry fortsetzen
+ }
+ }
+ }
+
+ // naechster Entry
+ pTestEntry = pTestEntry->GetRight();
+ }
+ }
+
+ // naechste Liste
+ pList = pList->GetDown();
+ }
+}
+
+/*************************************************************************
+|*
+|* Berechne den Schnitt zwischen den beiden Kanten und gib den
+|* Schnittpunkt im Parameterbereich der 1. Kante zurueck
+|*
+\************************************************************************/
+
+double B3dComplexPolygon::FindCut(B3dEdgeEntry* pEdge1, B3dEdgeEntry* pEdge2)
+{
+ double fRetval = 0.0;
+ double fDeltaEdge2Y = pEdge2->GetYPos() - pEdge2->GetParent()->GetYPos();
+ double fDeltaEdge2X = pEdge2->GetXPos() - pEdge2->GetParent()->GetXPos();
+ double fDeltaEdge1X = pEdge1->GetXPos() - pEdge1->GetParent()->GetXPos();
+ double fDeltaEdge1Y = pEdge1->GetYPos() - pEdge1->GetParent()->GetYPos();
+
+ // Dynamische Grenze fuer parallelitaet berechnen
+ double fSmallValue = fabs((fDeltaEdge2Y + fDeltaEdge2X + fDeltaEdge1X + fDeltaEdge1Y) * (SMALL_DVALUE / 4.0));
+ double fZwi = (fDeltaEdge1X * fDeltaEdge2Y) - (fDeltaEdge1Y * fDeltaEdge2X);
+
+ if(fabs(fZwi) > fSmallValue)
+ {
+ fZwi = (fDeltaEdge2Y * (pEdge2->GetParent()->GetXPos() - pEdge1->GetParent()->GetXPos())
+ + fDeltaEdge2X * (pEdge1->GetParent()->GetYPos() - pEdge2->GetParent()->GetYPos())) / fZwi;
+
+ // Im Parameterbereich der ersten Kante (ohne Punkte) ?
+ if(fZwi > fSmallValue && fZwi < 1.0 - fSmallValue)
+ {
+ // Schnitt liegt im Parameterbereich der ersten
+ // Linie, aber auch in dem der zweiten?
+ if(fabs(fDeltaEdge2X) > fSmallValue && fabs(fDeltaEdge2X) > fabs(fDeltaEdge2Y))
+ {
+ fDeltaEdge2Y = (pEdge1->GetParent()->GetXPos() + fZwi
+ * fDeltaEdge1X - pEdge2->GetParent()->GetXPos()) / fDeltaEdge2X;
+
+ // Parameterbereich der zweiten schliesst Start/Ende mit ein!
+ if(fDeltaEdge2Y > -fSmallValue && fDeltaEdge2Y < 1.0 + fSmallValue)
+ {
+ // Ja. Zuweisen.
+ fRetval = fZwi;
+ }
+ }
+ else if(fabs(fDeltaEdge2Y) > fSmallValue)
+ {
+ fDeltaEdge2X = (pEdge1->GetParent()->GetYPos() + fZwi
+ * fDeltaEdge1Y - pEdge2->GetParent()->GetYPos()) / fDeltaEdge2Y;
+
+ // Parameterbereich der zweiten schliesst Start/Ende mit ein!
+ if(fDeltaEdge2X > -fSmallValue && fDeltaEdge2X < 1.0 + fSmallValue)
+ {
+ // Ja. Zuweisen.
+ fRetval = fZwi;
+ }
+ }
+ }
+ }
+ return fRetval;
+}
+
+/*************************************************************************
+|*
+|* Testet, ob die angegebene Kante schon existiert
+|* Ja: Entfernen
+|* Nein: Einfuegen
+|*
+\************************************************************************/
+
+BOOL B3dComplexPolygon::SwitchEdgeExistance(B3dEntity* pStart,
+ B3dEntity* pEnd)
+{
+ if(DoSwap(pStart, pEnd))
+ {
+ B3dEntity* pZwi = pStart;
+ pStart = pEnd;
+ pEnd = pZwi;
+ }
+
+ if(pEdgeList)
+ {
+ // Suchen
+ B3dEdgeList* pList = pEdgeList;
+ while(pList && pList->GetStart() != pStart)
+ pList = pList->GetDown();
+
+ if(pList && pList->GetStart() == pStart)
+ {
+ // Liste gefunden, Eintrag mit Endpunkt
+ // pEnd finden
+ B3dEdgeEntry* pEntry = pList->GetEntries();
+ B3dEdgeEntry* pLeft = NULL;
+
+ while(pEntry)
+ {
+ if(pEntry->GetEnd() == pEnd)
+ {
+ // Kante existiert, austragen
+ // Liste ist pList
+ // Links ist pLeft
+ if(pLeft)
+ {
+ pLeft->SetRight(pEntry->GetRight());
+ }
+ else
+ {
+ if(pEntry->GetRight())
+ pList->SetEntries(pEntry->GetRight());
+ else
+ RemoveEdgeList(pList);
+ }
+ // fertig
+ return TRUE;
+ }
+
+ // naechste Kante
+ pLeft = pEntry;
+ pEntry = pEntry->GetRight();
+ }
+
+ // Liste existiert, aber der EdgeEintrag nicht.
+ // Fuege diesen hinzu
+ InsertEdge(pList, pEnd, FALSE);
+
+ // fertig
+ return FALSE;
+ }
+ }
+ // Liste und Eintrag existieren nicht
+ // Erzeuge beides
+ InsertEdge(GetList(pStart), pEnd, FALSE);
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Entferne die Kante aus der Kantenliste. Tue alles weitere,
+|* um die Struktur weiter aufzuloesen
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::RemoveFirstEdge(B3dEdgeList* pList)
+{
+ if(pList->GetEntries()->GetRight())
+ pList->SetEntries(pList->GetEntries()->GetRight());
+ else
+ RemoveEdgeList(pList);
+}
+
+/*************************************************************************
+|*
+|* Entferne die Kantenliste. Tue alles weitere,
+|* um die Struktur weiter aufzuloesen
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::RemoveEdgeList(B3dEdgeList* pList)
+{
+ if(pList->GetDown())
+ pList->GetDown()->SetParent(pList->GetParent());
+ if(pList->GetParent())
+ pList->GetParent()->SetDown(pList->GetDown());
+ else
+ {
+ // Es gibt keinen parent mehr
+ pEdgeList = pList->GetDown();
+ }
+}
+
+/*************************************************************************
+|*
+|* Extrahiere das naechste Dreieck aus der Kantenliste
+|* und zeichne es
+|*
+\************************************************************************/
+
+void B3dComplexPolygon::ExtractTriangle()
+{
+ B3dEdgeEntry* pLeft = pEdgeList->GetEntries();
+ B3dEdgeEntry* pRight = pLeft->GetRight();
+
+ if(!pRight)
+ {
+// DBG_ASSERT(0, "AW: Einzelne Kante als Startpunkt!");
+ RemoveFirstEdge(pEdgeList);
+ return;
+ }
+
+ B3dEdgeList* pList = FindStartInTriangle();
+ BOOL bNotAllAligned = (fabs(GetSlant(pLeft) - GetSlant(pRight)) > SMALL_DVALUE);
+ BOOL bStartIsEdgePoint = FALSE;
+ if(pList)
+ {
+ const Vector3D& rListStart = pList->GetStart()->Point().GetVector3D();
+ if((rListStart - pEdgeList->GetStart()->Point().GetVector3D()).GetLength() < SMALL_DVALUE)
+ bStartIsEdgePoint = TRUE;
+ else if((rListStart - pLeft->GetEnd()->Point().GetVector3D()).GetLength() < SMALL_DVALUE)
+ bStartIsEdgePoint = TRUE;
+ else if((rListStart - pRight->GetEnd()->Point().GetVector3D()).GetLength() < SMALL_DVALUE)
+ bStartIsEdgePoint = TRUE;
+ }
+
+ if(pList && bNotAllAligned && !bStartIsEdgePoint)
+ {
+ // Zerlegen in 2 Teildreiecke
+ // Erstes Teildreieck
+ InsertEdge(pEdgeList, pList->GetStart(), FALSE);
+ ExtractTriangle();
+
+ // Zweites Teildreieck
+ InsertEdge(pEdgeList, pList->GetStart(), FALSE);
+ ExtractTriangle();
+ }
+ else
+ {
+ B3dEntity* pEntLeft = pLeft->GetEnd();
+ B3dEntity* pEntRight = pRight->GetEnd();
+ B3dEntity* pEntTop = pEdgeList->GetStart();
+ BOOL bLeftVisible = pLeft->IsEdgeVisible();
+ BOOL bRightVisible = pRight->IsEdgeVisible();
+
+ RemoveFirstEdge(pEdgeList);
+ RemoveFirstEdge(pEdgeList);
+
+ if(pEntLeft != pEntRight)
+ {
+ // Merken, ob die Abschlusslinie existiert hat oder nicht
+ BOOL bDidEdgeExist = SwitchEdgeExistance(pEntLeft, pEntRight);
+
+ if(DOUBLE_NOT_EQUAL(pEntLeft->GetY(), pEntTop->GetY())
+ || DOUBLE_NOT_EQUAL(pEntRight->GetY(), pEntTop->GetY()))
+ {
+ if(!bOrientationValid)
+ {
+ // Anhand des ersten Dreiecks entscheiden,
+ // in welcher Orientierung die Dreiecke
+ // auszugeben sind
+ Vector3D aTmpNormal =
+ (pEntLeft->Point().GetVector3D() - pEntTop->Point().GetVector3D())
+ |(pEntRight->Point().GetVector3D() - pEntTop->Point().GetVector3D());
+
+ bOrientation = (aNormal.Scalar(aTmpNormal) > 0.0) ? TRUE : FALSE;
+ bOrientationValid = TRUE;
+ }
+
+ // Dreieck ausgeben
+ if(pBase3D)
+ {
+ if(bOrientation)
+ {
+ // Rechtsrum
+ pBase3D->SetEdgeFlag(bRightVisible);
+ pBase3D->AddVertex(*pEntTop);
+ pBase3D->SetEdgeFlag(bDidEdgeExist);
+ pBase3D->AddVertex(*pEntRight);
+ pBase3D->SetEdgeFlag(bLeftVisible);
+ pBase3D->AddVertex(*pEntLeft);
+ }
+ else
+ {
+ // Linksrum
+ pBase3D->SetEdgeFlag(bLeftVisible);
+ pBase3D->AddVertex(*pEntTop);
+ pBase3D->SetEdgeFlag(bDidEdgeExist);
+ pBase3D->AddVertex(*pEntLeft);
+ pBase3D->SetEdgeFlag(bRightVisible);
+ pBase3D->AddVertex(*pEntRight);
+ }
+ }
+ else if(pGeometry)
+ {
+ pGeometry->StartComplexPrimitive();
+ if(bOrientation)
+ {
+ // Rechtsrum
+ pGeometry->AddComplexVertex(*pEntTop, bRightVisible);
+ pGeometry->AddComplexVertex(*pEntRight, bDidEdgeExist);
+ pGeometry->AddComplexVertex(*pEntLeft, bLeftVisible);
+ }
+ else
+ {
+ // Linksrum
+ pGeometry->AddComplexVertex(*pEntTop, bLeftVisible);
+ pGeometry->AddComplexVertex(*pEntLeft, bDidEdgeExist);
+ pGeometry->AddComplexVertex(*pEntRight, bRightVisible);
+ }
+ pGeometry->EndComplexPrimitive();
+ }
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Suche nach einem fremden Startpunkt innerhalb des zu zeichnenden
+|* naechsten Dreiecks
+|*
+\************************************************************************/
+
+B3dEdgeList* B3dComplexPolygon::FindStartInTriangle()
+{
+ B3dEdgeList* pList = pEdgeList->GetDown();
+ if(pList)
+ {
+ B3dEdgeEntry* pLeft = pEdgeList->GetEntries();
+ B3dEdgeEntry* pRight = pLeft->GetRight();
+
+ double fYMax = pLeft->GetYPos();
+ double fZwi = pRight->GetYPos();
+ if(fZwi > fYMax)
+ fYMax = fZwi;
+
+ if(pList->GetYPos() <= fYMax)
+ {
+ B3dEntity* pTop = pEdgeList->GetStart();
+ double fXMin = pLeft->GetXPos();
+ double fXMax = pRight->GetXPos();
+ if(fXMin > fXMax)
+ {
+ fZwi = fXMin;
+ fXMin = fXMax;
+ fXMax = fZwi;
+ }
+
+ double fXTop = pTop->GetX();
+ if(fXMin > fXTop)
+ fXMin = fXTop;
+ if(fXMax < fXTop)
+ fXMax = fXTop;
+
+ while(pList
+ && pList->GetYPos() <= fYMax)
+ {
+ if(pList->GetXPos() > fXMin && pList->GetXPos() < fXMax)
+ {
+ if(pList->GetStart() != pLeft->GetEnd()
+ && pList->GetStart() != pRight->GetEnd())
+ {
+ if(IsLeft(pTop, pLeft->GetEnd(), pList->GetStart()))
+ {
+ if(DOUBLE_NOT_EQUAL(pList->GetXPos(), pLeft->GetXPos())
+ || DOUBLE_NOT_EQUAL(pList->GetYPos(), pLeft->GetYPos()))
+ {
+ if(IsLeft(pRight->GetEnd(), pTop, pList->GetStart()))
+ {
+ if(DOUBLE_NOT_EQUAL(pList->GetXPos(), pRight->GetXPos())
+ || DOUBLE_NOT_EQUAL(pList->GetYPos(), pRight->GetYPos()))
+ {
+ if(IsLeft(pLeft->GetEnd(), pRight->GetEnd(),
+ pList->GetStart()))
+ {
+ return pList;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // naechste Liste
+ pList = pList->GetDown();
+ }
+ }
+ }
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Testen, auf welcher Seite pPoint von der Linie pTop, pDirection liegt
+|*
+\************************************************************************/
+
+BOOL B3dComplexPolygon::IsLeft(B3dEntity* pTop, B3dEntity* pDirection,
+ B3dEntity* pPoint)
+{
+ double fDirX = pDirection->GetX() - pTop->GetX();
+ double fDirY = pDirection->GetY() - pTop->GetY();
+ double fPntX = pPoint->GetX() - pTop->GetX();
+ double fPntY = pPoint->GetY() - pTop->GetY();
+
+ return ((fDirX * fPntY - fDirY * fPntX) <= 0.0);
+}
+
diff --git a/goodies/source/base3d/b3ddeflt.cxx b/goodies/source/base3d/b3ddeflt.cxx
new file mode 100644
index 000000000000..a626ad797406
--- /dev/null
+++ b/goodies/source/base3d/b3ddeflt.cxx
@@ -0,0 +1,1786 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3ddeflt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DDEFLT_HXX
+#include "b3ddeflt.hxx"
+#endif
+
+#ifndef _B3D_B3DTRANS_HXX
+#include "b3dtrans.hxx"
+#endif
+
+#ifndef _SV_OUTDEV_HXX
+#include
+#endif
+
+#ifndef _SV_BMPACC_HXX
+#include
+#endif
+
+#ifndef _SV_BITMAPEX_HXX
+#include
+#endif
+
+#ifndef _B3D_B3DTEX_HXX
+#include "b3dtex.hxx"
+#endif
+
+/*************************************************************************
+|*
+|* Konstruktor Base3DDefault
+|*
+\************************************************************************/
+
+Base3DDefault::Base3DDefault(OutputDevice* pOutDev)
+: Base3DCommon(pOutDev),
+ aZBuffer(),
+ aPicture(),
+ aMonoTransparence(),
+ aAlphaTransparence(),
+ aClearValue(Color(0x00ffffff)),
+ pZBufferWrite(NULL),
+ pPictureWrite(NULL),
+ pTransparenceWrite(NULL),
+ fDetail(1.0),
+ bReducedDetail(FALSE),
+ bDetailBackedup(FALSE),
+ fDetailBackup( -1.0 ),
+ nMaxPixels(500000)
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor Base3DDefault
+|*
+\************************************************************************/
+
+Base3DDefault::~Base3DDefault()
+{
+ // Alle Bitmap-Zugriffe freigeben
+ ReleaseAccess();
+}
+
+/*************************************************************************
+|*
+|* Typbestimmung
+|*
+\************************************************************************/
+
+UINT16 Base3DDefault::GetBase3DType()
+{
+ return BASE3D_TYPE_DEFAULT;
+}
+
+/*************************************************************************
+|*
+|* Darstellungsqualitaet setzen
+|*
+\************************************************************************/
+
+void Base3DDefault::SetDisplayQuality(UINT8 nNew)
+{
+ // Entsprechende PixelGrenze setzen
+ SetMaxPixels(((long)nNew * 3500) + 3500);
+
+ // call parent
+ Base3D::SetDisplayQuality(nNew);
+}
+
+/*************************************************************************
+|*
+|* Vergroeberungsstufe setzen
+|*
+\************************************************************************/
+
+void Base3DDefault::SetDetail(double fNew)
+{
+ // nach unten begrenzen
+ if(fNew > 1.0)
+ fNew = 1.0;
+
+ fDetail = fNew;
+ if(fDetail < 1.0)
+ {
+ bReducedDetail = TRUE;
+ }
+ else
+ {
+ bReducedDetail = FALSE;
+ }
+}
+
+/*************************************************************************
+|*
+|* BitmapAccess holen
+|*
+\************************************************************************/
+
+void Base3DDefault::AcquireAccess()
+{
+ // Alle accesses holen
+ pZBufferWrite = aZBuffer.AcquireWriteAccess();
+ pPictureWrite = aPicture.AcquireWriteAccess();
+ pTransparenceWrite = (GetTransparentPartsContainedHint())
+ ? aAlphaTransparence.AcquireWriteAccess()
+ : aMonoTransparence.AcquireWriteAccess();
+}
+
+/*************************************************************************
+|*
+|* BitmapAccess freigeben
+|*
+\************************************************************************/
+
+void Base3DDefault::ReleaseAccess()
+{
+ // Alle accesses wieder freigeben
+ if(pZBufferWrite)
+ {
+ delete pZBufferWrite;
+ pZBufferWrite = NULL;
+ }
+
+ if(pPictureWrite)
+ {
+ delete pPictureWrite;
+ pPictureWrite = NULL;
+ }
+
+ if(pTransparenceWrite)
+ {
+ delete pTransparenceWrite;
+ pTransparenceWrite = NULL;
+ }
+}
+
+/*************************************************************************
+|*
+|* Start der Szenenbeschreibung:
+|*
+\************************************************************************/
+
+void Base3DDefault::StartScene()
+{
+ // Zugriffe freigeben
+ ReleaseAccess();
+
+ // Groesse der Bitmaps anpassen?
+ BOOL bSizeHasChanged = (aLocalSizePixel.GetSize() != aPicture.GetSizePixel());
+
+ // Neue BitMaps fuer ZBuffer und Picture allokieren
+ if(bSizeHasChanged || !aZBuffer || !aPicture)
+ {
+ aZBuffer = Bitmap(aLocalSizePixel.GetSize(), 24);
+ aPicture = Bitmap(aLocalSizePixel.GetSize(), 24);
+ }
+
+ // ZBuffer loeschen
+ aZBuffer.Erase(aClearValue);
+
+ // Bild loeschen
+ aPicture.Erase( GetOutputDevice()->GetBackground().GetColor() );
+
+ // Neue Transparenz-Bitmap allokieren
+ if(GetTransparentPartsContainedHint())
+ {
+ // Alpha-Channel
+ if(bSizeHasChanged || !aAlphaTransparence)
+ {
+ aAlphaTransparence = AlphaMask(aLocalSizePixel.GetSize());
+ if(!!aMonoTransparence)
+ aMonoTransparence = Bitmap();
+ }
+
+ // zu Beginn alles transparent
+ aAlphaTransparence.Erase(BYTE(0xff));
+ }
+ else
+ {
+ // Mono-Channel
+ if(bSizeHasChanged || !aMonoTransparence)
+ {
+ aMonoTransparence = Bitmap(aLocalSizePixel.GetSize(), 1);
+ if(!!aAlphaTransparence)
+ aAlphaTransparence = AlphaMask();
+ }
+
+ // zu Beginn alles transparent
+ Color aEraseCol(COL_WHITE);
+ aMonoTransparence.Erase(aEraseCol);
+ }
+
+ // Zugriffe wieder holen
+ AcquireAccess();
+
+ // lokale ClipRegion anpassen
+ if(IsScissorRegionActive())
+ {
+ // Default specifics for scissoring
+ aDefaultScissorRectangle = GetScissorRegionPixel();
+ aDefaultScissorRectangle -= aSizePixel.TopLeft();
+
+ // Detailstufe beachten
+ if(bReducedDetail && fDetail != 0.0)
+ {
+ long nReducedWidth = (long)((double)(aDefaultScissorRectangle.GetWidth() - 1) * fDetail);
+ long nReducedHeight = (long)((double)(aDefaultScissorRectangle.GetHeight() - 1)* fDetail);
+ aDefaultScissorRectangle.SetSize(Size(nReducedWidth + 1, nReducedHeight + 1));
+ }
+ }
+
+ // call parent
+ Base3DCommon::StartScene();
+}
+
+/*************************************************************************
+|*
+|* Ende der Szenenbeschreibung:
+|*
+\************************************************************************/
+
+void Base3DDefault::EndScene()
+{
+ // Zugriffe freigeben
+ ReleaseAccess();
+
+ // Ausgabe der erzeugten BitMap
+ BitmapEx aBitmapEx;
+
+ if(GetTransparentPartsContainedHint())
+ {
+ // Alpha-Transparenz
+ aBitmapEx = BitmapEx(aPicture, aAlphaTransparence);
+ }
+ else
+ {
+ // Mono-Transparenz
+ aBitmapEx = BitmapEx(aPicture, aMonoTransparence);
+ }
+
+ // Dithern
+ UINT16 nBitCount = GetOutputDevice()->GetBitCount();
+ if( GetOutputDevice()->GetOutDevType() != OUTDEV_PRINTER && nBitCount <= 16 && GetDither())
+ {
+ aBitmapEx.Dither(nBitCount <= 8
+ ? BMP_DITHER_MATRIX
+ : BMP_DITHER_FLOYD_16);
+ }
+
+ if(GetOutputDevice()->GetConnectMetaFile() != NULL)
+ {
+ Rectangle aLogicRect;
+ aLogicRect = GetOutputDevice()->PixelToLogic(aSizePixel);
+ aBitmapEx.Draw(GetOutputDevice(), aLogicRect.TopLeft(), aLogicRect.GetSize());
+ }
+ else
+ {
+ BOOL bWasEnabled = GetOutputDevice()->IsMapModeEnabled();
+ GetOutputDevice()->EnableMapMode(FALSE);
+
+#ifdef DBG_UTIL // draw for testing
+ static BOOL bDoDrawBitmapForTesting(FALSE);
+ if(bDoDrawBitmapForTesting)
+ {
+ Bitmap aBmp( aBitmapEx.GetMask() );
+ aBmp.Convert( BMP_CONVERSION_4BIT_COLORS );
+ aBmp.Replace( COL_WHITE, COL_LIGHTRED );
+ GetOutputDevice()->DrawBitmap( aSizePixel.TopLeft(), aSizePixel.GetSize(), aBmp );
+ GetOutputDevice()->SetFillColor( COL_LIGHTRED );
+ GetOutputDevice()->SetLineColor( COL_LIGHTRED );
+ GetOutputDevice()->DrawRect( aSizePixel );
+ }
+#endif
+
+ aBitmapEx.Draw(GetOutputDevice(), aSizePixel.TopLeft(), aSizePixel.GetSize());
+ GetOutputDevice()->EnableMapMode(bWasEnabled);
+ }
+
+ // Zugriffe wieder holen
+ AcquireAccess();
+
+ // eventuelle temporaere Reduzierung der Aufloesung zuruecknehmen
+ if(bDetailBackedup)
+ {
+ SetDetail(fDetailBackup);
+ bDetailBackedup = FALSE;
+ }
+
+ // call parent
+ Base3DCommon::EndScene();
+}
+
+/*************************************************************************
+|*
+|* Callbacks bei Matrixaenderungen
+|*
+|* Ausgaberechteck innerhalb des OutputDevice festlegen. Die Koordinaten
+|* sind device-spezifisch, muessen also evtl. erst auf pixelkoordinaten
+|* umgerechnet werden
+|*
+\************************************************************************/
+
+void Base3DDefault::SetTransformationSet(B3dTransformationSet* pSet)
+{
+ // call parent
+ Base3DCommon::SetTransformationSet(pSet);
+
+ if(GetTransformationSet())
+ {
+ // eventuelle temporaere Reduzierung der Aufloesung zuruecknehmen
+ if(bDetailBackedup)
+ {
+ SetDetail(fDetailBackup);
+ bDetailBackedup = FALSE;
+ }
+
+ // Neue Groesse fuer die Ausgabe
+ aSizePixel = GetOutputDevice()->LogicToPixel(
+ GetTransformationSet()->GetLogicalViewportBounds());
+
+ // Eventuell durch ClipRegion eingeschraenkt? Dies
+ // muss beachtet werden
+ if(IsScissorRegionActive())
+ {
+ // draw region even smaller
+ aSizePixel.Intersection(GetScissorRegionPixel());
+ }
+
+ // Testen, ob die Bitmap zu gross wird
+ aLocalSizePixel = aSizePixel;
+ long nQuadSize = aLocalSizePixel.GetWidth() * aLocalSizePixel.GetHeight();
+
+ if(nQuadSize > GetMaxPixels())
+ {
+ // Groesse reduzieren
+ double fFactor = sqrt((double)GetMaxPixels() / (double)nQuadSize);
+
+ // Bei Druckjobs die Reduzierung einschraenken
+ if(fFactor < 0.25 && GetOutputDevice()->GetOutDevType() == OUTDEV_PRINTER)
+ fFactor = 0.25;
+
+ // Wird hier mehr reduziert als sowieso schon eingestellt ist?
+ if(fFactor < fDetail)
+ {
+ fDetailBackup = GetDetail();
+ bDetailBackedup = TRUE;
+ SetDetail(fFactor);
+ }
+ }
+
+ // Detailstufe beachten
+ if(bReducedDetail && fDetail != 0.0)
+ {
+ long nReducedWidth = (long)((double)(aLocalSizePixel.GetWidth() - 1) * fDetail);
+ long nReducedHeight = (long)((double)(aLocalSizePixel.GetHeight() - 1)* fDetail);
+ aLocalSizePixel.SetSize(Size(nReducedWidth + 1, nReducedHeight + 1));
+ }
+
+ // Falls die Groesse null ist, groesse auf 1,1 setzen
+ if(aLocalSizePixel.GetSize().Width() < 1)
+ aLocalSizePixel.SetSize(Size(1 , aLocalSizePixel.GetSize().Height()));
+ if(aLocalSizePixel.GetSize().Height() < 1)
+ aLocalSizePixel.SetSize(Size(aLocalSizePixel.GetSize().Width(), 1));
+ }
+}
+
+/*************************************************************************
+|*
+|* Pixelkoordinaten des Punktes innerhalb der Bitmap holen
+|*
+\************************************************************************/
+
+Point Base3DDefault::GetPixelCoor(B3dEntity& rEntity)
+{
+ if(bReducedDetail && fDetail != 0.0)
+ {
+ Point aRetval = GetOutputDevice()->LogicToPixel(
+ Point((long)(rEntity.Point().X()),
+ (long)(rEntity.Point().Y()))) - aSizePixel.TopLeft();
+ aRetval.X() = (long)((double)aRetval.X() * fDetail);
+ aRetval.Y() = (long)((double)aRetval.Y() * fDetail);
+ return aRetval;
+ }
+ else
+ {
+ return GetOutputDevice()->LogicToPixel(
+ Point((long)(rEntity.Point().X()),
+ (long)(rEntity.Point().Y()))) - aSizePixel.TopLeft();
+ }
+}
+
+/*************************************************************************
+|*
+|* 3DPunkt aus Pixelkoordinaten und Tiefe rekonstruieren
+|*
+\************************************************************************/
+
+Vector3D Base3DDefault::Get3DCoor(Point& rPnt, double fDepth)
+{
+ if(bReducedDetail && fDetail != 0.0)
+ {
+ Point aPnt(rPnt);
+ aPnt.X() = (long)((double)aPnt.X() / fDetail);
+ aPnt.Y() = (long)((double)aPnt.Y() / fDetail);
+ aPnt = GetOutputDevice()->PixelToLogic(aPnt + aSizePixel.TopLeft());
+ return Vector3D(aPnt.X(), aPnt.Y(), fDepth);
+ }
+ else
+ {
+ Point aPnt = GetOutputDevice()->PixelToLogic(rPnt + aSizePixel.TopLeft());
+ return Vector3D(aPnt.X(), aPnt.Y(), fDepth);
+ }
+}
+
+/*************************************************************************
+|*
+|* ZBuffer Sichtbarkeitstest
+|*
+\************************************************************************/
+
+BOOL Base3DDefault::IsVisibleAndScissor(long nX, long nY, UINT32 nDepth)
+{
+ if(!IsScissorRegionActive() || IsInScissorRegion(nX, nY))
+ {
+ const BitmapColor& rBmCol = pZBufferWrite->GetPixel(nY, nX);
+ Color aColor(rBmCol.GetRed(), rBmCol.GetGreen(), rBmCol.GetBlue());
+ return (aColor.GetColor() >= nDepth);
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Scissoring Sichtbarkeitstest
+|*
+\************************************************************************/
+
+BOOL Base3DDefault::IsInScissorRegion(long nX, long nY)
+{
+ if(nX < aDefaultScissorRectangle.Left())
+ return FALSE;
+ if(nY < aDefaultScissorRectangle.Top())
+ return FALSE;
+ if(nX > aDefaultScissorRectangle.Right())
+ return FALSE;
+ if(nY > aDefaultScissorRectangle.Bottom())
+ return FALSE;
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Pixel setzen in allen Buffern
+|*
+\************************************************************************/
+
+void Base3DDefault::WritePixel(long nX, long nY, Color aColor, UINT32 nDepth)
+{
+ // In Transparenz-Map eintragen
+ if(GetTransparentPartsContainedHint())
+ {
+ if(aColor.GetTransparency())
+ {
+ BYTE nOldTrans = pTransparenceWrite->GetPixel(nY, nX).GetIndex();
+
+ if(nOldTrans != (BYTE)0xff)
+ {
+ // Farbe mischen
+ BitmapColor aOldCol = pPictureWrite->GetPixel(nY, nX);
+ UINT16 nNegTrans = 0x0100 - (UINT16)aColor.GetTransparency();
+ aColor.SetRed((BYTE)((((UINT16)aOldCol.GetRed() * (UINT16)aColor.GetTransparency())
+ + (aColor.GetRed() * nNegTrans)) >> 8));
+ aColor.SetGreen((BYTE)((((UINT16)aOldCol.GetGreen() * (UINT16)aColor.GetTransparency())
+ + (aColor.GetGreen() * nNegTrans)) >> 8));
+ aColor.SetBlue((BYTE)((((UINT16)aOldCol.GetBlue() * (UINT16)aColor.GetTransparency())
+ + (aColor.GetBlue() * nNegTrans)) >> 8));
+ pPictureWrite->SetPixel(nY, nX, aColor);
+
+ // Transparenz mischen
+ pTransparenceWrite->SetPixel(nY, nX,
+ (BYTE)(((UINT16)(nOldTrans+1) * (UINT16)aColor.GetTransparency()) >> 8));
+ }
+ else
+ {
+ // Pixel setzen
+ pPictureWrite->SetPixel(nY, nX, aColor);
+
+ // Alpha-Wert setzen
+ pTransparenceWrite->SetPixel(nY, nX, aColor.GetTransparency());
+ }
+ }
+ else
+ {
+ // Pixel setzen
+ pPictureWrite->SetPixel(nY, nX, aColor);
+
+ // Alpha-Wert setzen
+ pTransparenceWrite->SetPixel(nY, nX, (BYTE)0x00);
+
+ // Z-Buffer setzen
+ Color aZBufCol(nDepth);
+ pZBufferWrite->SetPixel(nY, nX, aZBufCol);
+ }
+ }
+ else
+ {
+ // Dieser Punkt in der Mono-Transparenz ist nicht transparent
+ BitmapColor aColBlack(BYTE(0));
+ pTransparenceWrite->SetPixel(nY, nX, aColBlack);
+
+ // Pixel setzen
+ pPictureWrite->SetPixel(nY, nX, aColor);
+
+ // Z-Buffer setzen
+ Color aZBufCol(nDepth);
+ pZBufferWrite->SetPixel(nY, nX, aZBufCol);
+ }
+}
+
+/*************************************************************************
+|*
+|* Zeichenfunktionen; alle Objekte sind geclippt
+|* Einzelner Punkt
+|*
+\************************************************************************/
+
+#define POLYGONOFFSET_VALUE (120)
+
+void Base3DDefault::Clipped3DPoint(UINT32 nInd)
+{
+ B3dEntity& rEntity = aBuffers[nInd];
+
+ // Geometrie holen
+ rEntity.ToDeviceCoor(GetTransformationSet());
+ Point aOutPoint = GetPixelCoor(rEntity);
+ UINT32 nDepth = (UINT32)rEntity.Point().Z();
+
+ // PolygonOffset beachten
+ if(GetPolygonOffset(Base3DPolygonOffsetPoint))
+ {
+ if(nDepth >= POLYGONOFFSET_VALUE)
+ nDepth -= POLYGONOFFSET_VALUE;
+ else
+ nDepth = 0;
+ }
+
+ // Zeichnen
+ if(IsVisibleAndScissor(aOutPoint.X(), aOutPoint.Y(), nDepth))
+ WritePixel(aOutPoint.X(), aOutPoint.Y(), rEntity.Color(), nDepth);
+}
+
+/*************************************************************************
+|*
+|* Zeichenfunktionen; alle Objekte sind geclippt
+|* Linie
+|*
+\************************************************************************/
+
+void Base3DDefault::Clipped3DLine(UINT32 nInd1, UINT32 nInd2)
+{
+ B3dEntity& rEntity1 = aBuffers[nInd1];
+ B3dEntity& rEntity2 = aBuffers[nInd2];
+ bNormalsUsed = rEntity1.IsNormalUsed() && rEntity2.IsNormalUsed();
+ bTextureUsed = IsTextureActive() && rEntity1.IsTexCoorUsed() && rEntity2.IsTexCoorUsed();
+
+ // ColorModel fuer diese Punkte anwenden, falls Normale vorhanden
+ // Danach Normale als ungueltig markieren, da nur noch die berechnete
+ // Farbe bei Aufteilungen weiter interpoliert wird
+ if(bNormalsUsed)
+ {
+ // Vektoren normalisieren
+ rEntity1.Normal().Normalize();
+ rEntity2.Normal().Normalize();
+
+ if(GetShadeModel() != Base3DPhong)
+ {
+ // Farben auswerten
+ rEntity1.Color() = SolveColorModel(GetMaterialObject(),
+ rEntity1.Normal(), rEntity1.Point().GetVector3D());
+ rEntity2.Color() = SolveColorModel(GetMaterialObject(),
+ rEntity2.Normal(), rEntity2.Point().GetVector3D());
+
+ // Die Normalen NICHT ungueltig machen, da die Entities
+ // eventuell noch fuer weitere Primitive benutzt werden.
+ // Aber lokal merken, dass die Normalen bereits ausgewertet sind
+ bNormalsUsed = FALSE;
+ }
+ }
+
+ // Geometrie holen
+ rEntity1.ToDeviceCoor(GetTransformationSet());
+ rEntity2.ToDeviceCoor(GetTransformationSet());
+ Rectangle aPrimitiveArea;
+
+ aOutPointTop = GetPixelCoor(rEntity1);
+ aOutPointLeft = GetPixelCoor(rEntity2);
+
+ if(IsScissorRegionActive())
+ {
+ aPrimitiveArea.Union(Rectangle(aOutPointTop, aOutPointTop));
+ aPrimitiveArea.Union(Rectangle(aOutPointLeft, aOutPointLeft));
+ }
+
+ if(!IsScissorRegionActive()
+ || (IsScissorRegionActive()
+ && !aDefaultScissorRectangle.GetIntersection(aPrimitiveArea).IsEmpty()))
+ {
+ if(bTextureUsed)
+ {
+ fTexWidth = (double)GetActiveTexture()->GetBitmapSize().Width();
+ fTexHeight = (double)GetActiveTexture()->GetBitmapSize().Height();
+ }
+
+ // Punkt, Farbe und Z-Wert interpolieren und die Linie gererieren
+ long nDx = aOutPointLeft.X() - aOutPointTop.X();
+ long nDy = aOutPointLeft.Y() - aOutPointTop.Y();
+ long nCount;
+
+ // Werte fuer Schleife vorbereiten
+ if(abs(nDx) > abs(nDy))
+ // ueber X gehen
+ nCount = abs(nDx);
+ else
+ // ueber Y gehen
+ nCount = abs(nDy);
+
+ if(nCount)
+ {
+ // Interpolatoren vorbereiten
+ aIntXPosLeft.Load(aOutPointTop.X(), aOutPointLeft.X(), nCount);
+ aIntXPosRight.Load(aOutPointTop.Y(), aOutPointLeft.Y(), nCount);
+ UINT32 nDepth;
+
+ // PolygonOffset beachten
+ if(GetPolygonOffset())
+ {
+ double fDepthLeft = rEntity1.Point().Z();
+ double fDepthRight = rEntity2.Point().Z();
+
+ if(fDepthLeft >= double(POLYGONOFFSET_VALUE))
+ fDepthLeft -= double(POLYGONOFFSET_VALUE);
+ else
+ fDepthLeft = 0.0;
+
+ if(fDepthRight >= double(POLYGONOFFSET_VALUE))
+ fDepthRight -= double(POLYGONOFFSET_VALUE);
+ else
+ fDepthRight = 0.0;
+
+ aIntDepthLine.Load(fDepthLeft, fDepthRight, nCount);
+ }
+ else
+ {
+ aIntDepthLine.Load(rEntity1.Point().Z(), rEntity2.Point().Z(), nCount);
+ }
+
+ // Texturkoordinateninterpolation?
+ if(bTextureUsed)
+ {
+ aIntTexSLine.Load(
+ rEntity1.TexCoor().X() * fTexWidth,
+ rEntity2.TexCoor().X() * fTexWidth,
+ nCount);
+ aIntTexTLine.Load(
+ rEntity1.TexCoor().Y() * fTexHeight,
+ rEntity2.TexCoor().Y() * fTexHeight,
+ nCount);
+ }
+
+ if(bNormalsUsed && GetShadeModel() == Base3DPhong)
+ {
+ // Normalen und Geometrie interpolieren
+ if(GetTransformationSet())
+ {
+ Vector3D aInvTrans = GetTransformationSet()->GetTranslate();
+ Vector3D aInvScale = GetTransformationSet()->GetScale();
+
+ // Tiefe und Normale vorbereiten
+ aIntVectorLine.Load(rEntity1.Normal(), rEntity2.Normal(), nCount);
+
+ // Linie zeichnen
+ if(bTextureUsed)
+ {
+ while(nCount--)
+ {
+ // weiterer Punkt
+ nDx = aIntXPosLeft.GetLongValue();
+ nDy = aIntXPosRight.GetLongValue();
+ nDepth = aIntDepthLine.GetUINT32Value();
+
+ if(IsVisibleAndScissor(nDx, nDy, nDepth))
+ {
+ Point aTmpPoint(nDx, nDy);
+ Vector3D aPoint = Get3DCoor(aTmpPoint, nDepth);
+ aPoint -= aInvTrans;
+ aPoint /= aInvScale;
+ Vector3D aNormal;
+ aIntVectorLine.GetVector3DValue(aNormal);
+ aNormal.Normalize();
+ Color aCol = SolveColorModel(GetMaterialObject(), aNormal, aPoint);
+ GetActiveTexture()->ModifyColor(aCol,
+ aIntTexSLine.GetDoubleValue(),
+ aIntTexTLine.GetDoubleValue());
+ WritePixel(nDx, nDy, aCol, nDepth);
+ }
+
+ if(nCount)
+ {
+ // Weiterschalten
+ aIntXPosLeft.Increment();
+ aIntXPosRight.Increment();
+ aIntDepthLine.Increment();
+ aIntVectorLine.Increment();
+ aIntTexSLine.Increment();
+ aIntTexTLine.Increment();
+ }
+ }
+ }
+ else
+ {
+ while(nCount--)
+ {
+ // weiterer Punkt
+ nDx = aIntXPosLeft.GetLongValue();
+ nDy = aIntXPosRight.GetLongValue();
+ nDepth = aIntDepthLine.GetUINT32Value();
+
+ if(IsVisibleAndScissor(nDx, nDy, nDepth))
+ {
+ Point aTmpPoint(nDx, nDy);
+ Vector3D aPoint = Get3DCoor(aTmpPoint, nDepth);
+ aPoint -= aInvTrans;
+ aPoint /= aInvScale;
+ Vector3D aNormal;
+ aIntVectorLine.GetVector3DValue(aNormal);
+ aNormal.Normalize();
+ Color aCol = SolveColorModel(GetMaterialObject(), aNormal, aPoint);
+ WritePixel(nDx, nDy, aCol, nDepth);
+ }
+
+ if(nCount)
+ {
+ // Weiterschalten
+ aIntXPosLeft.Increment();
+ aIntXPosRight.Increment();
+ aIntDepthLine.Increment();
+ aIntVectorLine.Increment();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if(rEntity1.Color() != rEntity2.Color())
+ {
+ // Farbe und Geometrie interpolieren
+ // Tiefe und Farbe vorbereiten
+ aIntColorLine.Load(rEntity1.Color(), rEntity2.Color(), nCount);
+
+ // Linie zeichnen
+ if(bTextureUsed)
+ {
+ while(nCount--)
+ {
+ // weiterer Punkt
+ nDx = aIntXPosLeft.GetLongValue();
+ nDy = aIntXPosRight.GetLongValue();
+ nDepth = aIntDepthLine.GetUINT32Value();
+
+ if(IsVisibleAndScissor(nDx, nDy, nDepth))
+ {
+ Color aCol = aIntColorLine.GetColorValue();
+ GetActiveTexture()->ModifyColor(aCol,
+ aIntTexSLine.GetDoubleValue(),
+ aIntTexTLine.GetDoubleValue());
+ WritePixel(nDx, nDy, aCol, nDepth);
+ }
+
+ if(nCount)
+ {
+ // Weiterschalten
+ aIntXPosLeft.Increment();
+ aIntXPosRight.Increment();
+ aIntDepthLine.Increment();
+ aIntColorLine.Increment();
+ aIntTexSLine.Increment();
+ aIntTexTLine.Increment();
+ }
+ }
+ }
+ else
+ {
+ while(nCount--)
+ {
+ // weiterer Punkt
+ nDx = aIntXPosLeft.GetLongValue();
+ nDy = aIntXPosRight.GetLongValue();
+ nDepth = aIntDepthLine.GetUINT32Value();
+
+ if(IsVisibleAndScissor(nDx, nDy, nDepth))
+ WritePixel(nDx, nDy, aIntColorLine.GetColorValue(), nDepth);
+
+ if(nCount)
+ {
+ // Weiterschalten
+ aIntXPosLeft.Increment();
+ aIntXPosRight.Increment();
+ aIntDepthLine.Increment();
+ aIntColorLine.Increment();
+ }
+ }
+ }
+ }
+ else
+ {
+ // Nur die Geometrie interpolieren
+ // Linie zeichnen
+ if(bTextureUsed)
+ {
+ while(nCount--)
+ {
+ // weiterer Punkt
+ nDx = aIntXPosLeft.GetLongValue();
+ nDy = aIntXPosRight.GetLongValue();
+ nDepth = aIntDepthLine.GetUINT32Value();
+
+ if(IsVisibleAndScissor(nDx, nDy, nDepth))
+ {
+ Color aCol = rEntity1.Color();
+ GetActiveTexture()->ModifyColor(aCol,
+ aIntTexSLine.GetDoubleValue(),
+ aIntTexTLine.GetDoubleValue());
+ WritePixel(nDx, nDy, aCol, nDepth);
+ }
+
+ if(nCount)
+ {
+ // Weiterschalten
+ aIntXPosLeft.Increment();
+ aIntXPosRight.Increment();
+ aIntDepthLine.Increment();
+ aIntTexSLine.Increment();
+ aIntTexTLine.Increment();
+ }
+ }
+ }
+ else
+ {
+ while(nCount--)
+ {
+ // weiterer Punkt
+ nDx = aIntXPosLeft.GetLongValue();
+ nDy = aIntXPosRight.GetLongValue();
+ nDepth = aIntDepthLine.GetUINT32Value();
+
+ if(IsVisibleAndScissor(nDx, nDy, nDepth))
+ WritePixel(nDx, nDy, rEntity1.Color(), nDepth);
+
+ if(nCount)
+ {
+ // Weiterschalten
+ aIntXPosLeft.Increment();
+ aIntXPosRight.Increment();
+ aIntDepthLine.Increment();
+ aIntTexSLine.Increment();
+ aIntTexTLine.Increment();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Zeichenfunktionen; alle Objekte sind geclippt
+|* Polygon
+|*
+\************************************************************************/
+
+void Base3DDefault::Clipped3DTriangle(UINT32 nInd1, UINT32 nInd2, UINT32 nInd3)
+{
+ B3dEntity& rEntity1 = aBuffers[nInd1];
+ B3dEntity& rEntity2 = aBuffers[nInd2];
+ B3dEntity& rEntity3 = aBuffers[nInd3];
+ bNormalsUsed = rEntity1.IsNormalUsed() && rEntity2.IsNormalUsed() && rEntity3.IsNormalUsed();
+ bTextureUsed = IsTextureActive() && rEntity1.IsTexCoorUsed() && rEntity2.IsTexCoorUsed() && rEntity3.IsTexCoorUsed();
+ Base3DMaterialMode eMode = Base3DMaterialFront;
+
+ // ColorModel fuer diese Punkte anwenden, falls Normale vorhanden
+ // Danach Normale als ungueltig markieren, da nur noch die berechnete
+ // Farbe bei Aufteilungen weiter interpoliert wird
+ if(bNormalsUsed)
+ {
+ // Vektoren normalisieren
+ rEntity1.Normal().Normalize();
+ rEntity2.Normal().Normalize();
+ rEntity3.Normal().Normalize();
+
+ if(GetShadeModel() != Base3DPhong)
+ {
+ // Normale berechnen, Farben auswerten
+ if(rEntity1.PlaneNormal().Z() < 0.0 && (GetLightGroup() && GetLightGroup()->GetModelTwoSide()))
+ eMode = Base3DMaterialBack;
+
+ rEntity1.Color() = SolveColorModel(
+ GetMaterialObject(eMode),
+ rEntity1.Normal(), rEntity1.Point().GetVector3D());
+ rEntity2.Color() = SolveColorModel(
+ GetMaterialObject(eMode),
+ rEntity2.Normal(), rEntity2.Point().GetVector3D());
+ rEntity3.Color() = SolveColorModel(
+ GetMaterialObject(eMode),
+ rEntity3.Normal(), rEntity3.Point().GetVector3D());
+
+ // Die Normalen NICHT ungueltig machen, da die Entities
+ // eventuell noch fuer weitere Primitive benutzt werden.
+ // Aber lokal merken, dass die Normalen bereits ausgewertet sind
+ bNormalsUsed = FALSE;
+ }
+ }
+
+ // Geometrie holen
+ rEntity1.ToDeviceCoor(GetTransformationSet());
+ rEntity2.ToDeviceCoor(GetTransformationSet());
+ rEntity3.ToDeviceCoor(GetTransformationSet());
+
+ // Punkte ordnen. Oberster nach pEntTop
+ if(rEntity1.Point().Y() < rEntity2.Point().Y()
+ && rEntity1.Point().Y() < rEntity3.Point().Y())
+ {
+ // rEntity1 ist der oberste
+ pEntTop = &rEntity1;
+
+ // Left, Right erst mal zuweisen
+ pEntRight = &rEntity3;
+ pEntLeft = &rEntity2;
+ }
+ else
+ {
+ if(rEntity2.Point().Y() < rEntity3.Point().Y())
+ {
+ // rEntity2 ist der oberste
+ pEntTop = &rEntity2;
+
+ // Left, Right erst mal zuweisen
+ pEntRight = &rEntity1;
+ pEntLeft = &rEntity3;
+ }
+ else
+ {
+ // rEntity3 ist der oberste
+ pEntTop = &rEntity3;
+
+ // Left, Right erst mal zuweisen
+ pEntRight = &rEntity2;
+ pEntLeft = &rEntity1;
+ }
+ }
+
+ // Werte holen
+ Rectangle aPrimitiveArea;
+
+ aOutPointTop = GetPixelCoor(*pEntTop);
+ aOutPointLeft = GetPixelCoor(*pEntLeft);
+ aOutPointRight = GetPixelCoor(*pEntRight);
+
+ if(IsScissorRegionActive())
+ {
+ aPrimitiveArea.Union(Rectangle(aOutPointTop, aOutPointTop));
+ aPrimitiveArea.Union(Rectangle(aOutPointLeft, aOutPointLeft));
+ aPrimitiveArea.Union(Rectangle(aOutPointRight, aOutPointRight));
+ }
+
+ if(!IsScissorRegionActive()
+ || (IsScissorRegionActive()
+ && !aDefaultScissorRectangle.GetIntersection(aPrimitiveArea).IsEmpty()))
+ {
+ if(bTextureUsed)
+ {
+ fTexWidth = (double)GetActiveTexture()->GetBitmapSize().Width();
+ fTexHeight = (double)GetActiveTexture()->GetBitmapSize().Height();
+ }
+
+ // Links und rechts ordnen
+ long nDeltaYLeft = aOutPointLeft.Y() - aOutPointTop.Y();
+ long nDeltaYRight = aOutPointRight.Y() - aOutPointTop.Y();
+ long nYLine;
+
+ if((aOutPointLeft.X() - aOutPointTop.X()) * nDeltaYRight
+ - nDeltaYLeft * (aOutPointRight.X() - aOutPointTop.X()) > 0)
+ {
+ // Links und rechts vertauschen
+ // Punkte
+ nYLine = aOutPointLeft.X();
+ aOutPointLeft.X() = aOutPointRight.X();
+ aOutPointRight.X() = nYLine;
+ nYLine = aOutPointLeft.Y();
+ aOutPointLeft.Y() = aOutPointRight.Y();
+ aOutPointRight.Y() = nYLine;
+
+ // Deltas
+ nYLine = nDeltaYLeft; nDeltaYLeft = nDeltaYRight; nDeltaYRight = nYLine;
+
+ // Zeiger auf Entities
+ B3dEntity* pTmp = pEntLeft; pEntLeft = pEntRight; pEntRight = pTmp;
+ }
+
+ // YStart, Links und rechts laden
+ nYLine = aOutPointTop.Y();
+ aIntXPosLeft.Load(aOutPointTop.X(), aOutPointLeft.X(), nDeltaYLeft);
+ aIntDepthLeft.Load(pEntTop->Point().Z(), pEntLeft->Point().Z(), nDeltaYLeft);
+ aIntXPosRight.Load(aOutPointTop.X(), aOutPointRight.X(), nDeltaYRight);
+ aIntDepthRight.Load(pEntTop->Point().Z(), pEntRight->Point().Z(), nDeltaYRight);
+ if(bTextureUsed)
+ {
+ aIntTexSLeft.Load(
+ pEntTop->TexCoor().X() * fTexWidth,
+ pEntLeft->TexCoor().X() * fTexWidth, nDeltaYLeft);
+ aIntTexTLeft.Load(
+ pEntTop->TexCoor().Y() * fTexHeight,
+ pEntLeft->TexCoor().Y() * fTexHeight, nDeltaYLeft);
+ aIntTexSRight.Load(
+ pEntTop->TexCoor().X() * fTexWidth,
+ pEntRight->TexCoor().X() * fTexWidth, nDeltaYRight);
+ aIntTexTRight.Load(
+ pEntTop->TexCoor().Y() * fTexHeight,
+ pEntRight->TexCoor().Y() * fTexHeight, nDeltaYRight);
+ }
+
+ if(bNormalsUsed && GetShadeModel() == Base3DPhong)
+ {
+ // Normalen und Geometrie interpolieren
+ aIntVectorLeft.Load(pEntTop->Normal(), pEntLeft->Normal(), nDeltaYLeft);
+ aIntVectorRight.Load(pEntTop->Normal(), pEntRight->Normal(), nDeltaYRight);
+ B3dMaterial& rMat = GetMaterialObject(eMode);
+
+ if(bTextureUsed)
+ {
+ // Schleife
+ while(nDeltaYLeft || nDeltaYRight)
+ {
+ // Zeile ausgeben
+ DrawLinePhongTexture(nYLine, rMat);
+
+ // naechste Zeile vorbereiten rechts
+ if(!nDeltaYRight && nDeltaYLeft)
+ {
+ // Rechts ist zuende, lade neu mit Rest nach links
+ nDeltaYRight = nDeltaYLeft;
+ LoadRightTexture(nDeltaYRight);
+ aIntVectorRight.Load(pEntRight->Normal(), pEntLeft->Normal(), nDeltaYRight);
+ }
+
+ // naechste Zeile vorbereiten links
+ if(!nDeltaYLeft && nDeltaYRight)
+ {
+ // Links ist zuende, lade neu mit Rest nach rechts
+ nDeltaYLeft = nDeltaYRight;
+ LoadLeftTexture(nDeltaYLeft);
+ aIntVectorLeft.Load(pEntLeft->Normal(), pEntRight->Normal(), nDeltaYLeft);
+ }
+
+ // naechste Zeile rechts
+ if(nDeltaYRight || nDeltaYLeft)
+ {
+ nDeltaYRight--;
+ NextStepRightTexture();
+ aIntVectorRight.Increment();
+
+ nDeltaYLeft--;
+ NextStepLeftTexture();
+ aIntVectorLeft.Increment();
+
+ nYLine++;
+ }
+ }
+ }
+ else
+ {
+ // Schleife
+ while(nDeltaYLeft || nDeltaYRight)
+ {
+ // Zeile ausgeben
+ DrawLinePhong(nYLine, rMat);
+
+ // naechste Zeile vorbereiten rechts
+ if(!nDeltaYRight && nDeltaYLeft)
+ {
+ // Rechts ist zuende, lade neu mit Rest nach links
+ nDeltaYRight = nDeltaYLeft;
+ LoadRight(nDeltaYRight);
+ aIntVectorRight.Load(pEntRight->Normal(), pEntLeft->Normal(), nDeltaYRight);
+ }
+
+ // naechste Zeile vorbereiten links
+ if(!nDeltaYLeft && nDeltaYRight)
+ {
+ // Links ist zuende, lade neu mit Rest nach rechts
+ nDeltaYLeft = nDeltaYRight;
+ LoadLeft(nDeltaYLeft);
+ aIntVectorLeft.Load(pEntLeft->Normal(), pEntRight->Normal(), nDeltaYLeft);
+ }
+
+ // naechste Zeile rechts
+ if(nDeltaYRight || nDeltaYLeft)
+ {
+ nDeltaYRight--;
+ NextStepRight();
+ aIntVectorRight.Increment();
+
+ nDeltaYLeft--;
+ NextStepLeft();
+ aIntVectorLeft.Increment();
+
+ nYLine++;
+ }
+ }
+ }
+ }
+ else
+ {
+ if(!(rEntity1.Color() == rEntity2.Color() && rEntity1.Color() == rEntity3.Color()))
+ {
+ // Farbe und Geometrie interpolieren
+ aIntColorLeft.Load(pEntTop->Color(), pEntLeft->Color(), nDeltaYLeft);
+ aIntColorRight.Load(pEntTop->Color(), pEntRight->Color(), nDeltaYRight);
+
+ if(bTextureUsed)
+ {
+ // Schleife
+ while(nDeltaYLeft || nDeltaYRight)
+ {
+ // Zeile ausgeben
+ DrawLineColorTexture(nYLine);
+
+ // naechste Zeile vorbereiten rechts
+ if(!nDeltaYRight && nDeltaYLeft)
+ {
+ // Rechts ist zuende, lade neu mit Rest nach links
+ nDeltaYRight = nDeltaYLeft;
+ LoadRightTexture(nDeltaYRight);
+ aIntColorRight.Load(pEntRight->Color(), pEntLeft->Color(), nDeltaYRight);
+ }
+
+ // naechste Zeile vorbereiten links
+ if(!nDeltaYLeft && nDeltaYRight)
+ {
+ // Links ist zuende, lade neu mit Rest nach rechts
+ nDeltaYLeft = nDeltaYRight;
+ LoadLeftTexture(nDeltaYLeft);
+ aIntColorLeft.Load(pEntLeft->Color(), pEntRight->Color(), nDeltaYLeft);
+ }
+
+ // naechste Zeile rechts
+ if(nDeltaYRight || nDeltaYLeft)
+ {
+ nDeltaYRight--;
+ NextStepRightTexture();
+ aIntColorRight.Increment();
+
+ nDeltaYLeft--;
+ NextStepLeftTexture();
+ aIntColorLeft.Increment();
+
+ nYLine++;
+ }
+ }
+ }
+ else
+ {
+ // Schleife
+ while(nDeltaYLeft || nDeltaYRight)
+ {
+ // Zeile ausgeben
+ DrawLineColor(nYLine);
+
+ // naechste Zeile vorbereiten rechts
+ if(!nDeltaYRight && nDeltaYLeft)
+ {
+ // Rechts ist zuende, lade neu mit Rest nach links
+ nDeltaYRight = nDeltaYLeft;
+ LoadRight(nDeltaYRight);
+ aIntColorRight.Load(pEntRight->Color(), pEntLeft->Color(), nDeltaYRight);
+ }
+
+ // naechste Zeile vorbereiten links
+ if(!nDeltaYLeft && nDeltaYRight)
+ {
+ // Links ist zuende, lade neu mit Rest nach rechts
+ nDeltaYLeft = nDeltaYRight;
+ LoadLeft(nDeltaYLeft);
+ aIntColorLeft.Load(pEntLeft->Color(), pEntRight->Color(), nDeltaYLeft);
+ }
+
+ // naechste Zeile rechts
+ if(nDeltaYRight || nDeltaYLeft)
+ {
+ nDeltaYRight--;
+ NextStepRight();
+ aIntColorRight.Increment();
+
+ nDeltaYLeft--;
+ NextStepLeft();
+ aIntColorLeft.Increment();
+
+ nYLine++;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Nur die Geometrie interpolieren
+ if(bTextureUsed)
+ {
+ // Schleife
+ while(nDeltaYLeft || nDeltaYRight)
+ {
+ // Zeile ausgeben
+ DrawLineTexture(nYLine, pEntTop->Color());
+
+ // naechste Zeile vorbereiten rechts
+ if(!nDeltaYRight && nDeltaYLeft)
+ {
+ // Rechts ist zuende, lade neu mit Rest nach links
+ nDeltaYRight = nDeltaYLeft;
+ LoadRightTexture(nDeltaYRight);
+ }
+
+ // naechste Zeile vorbereiten links
+ if(!nDeltaYLeft && nDeltaYRight)
+ {
+ // Links ist zuende, lade neu mit Rest nach rechts
+ nDeltaYLeft = nDeltaYRight;
+ LoadLeftTexture(nDeltaYLeft);
+ }
+
+ // naechste Zeile rechts
+ if(nDeltaYRight || nDeltaYLeft)
+ {
+ nDeltaYRight--;
+ NextStepRightTexture();
+
+ nDeltaYLeft--;
+ NextStepLeftTexture();
+
+ nYLine++;
+ }
+ }
+ }
+ else
+ {
+ // Schleife
+ while(nDeltaYLeft || nDeltaYRight)
+ {
+ // Zeile ausgeben
+ DrawLine(nYLine, pEntTop->Color());
+
+ // naechste Zeile vorbereiten rechts
+ if(!nDeltaYRight && nDeltaYLeft)
+ {
+ // Rechts ist zuende, lade neu mit Rest nach links
+ nDeltaYRight = nDeltaYLeft;
+ LoadRight(nDeltaYRight);
+ }
+
+ // naechste Zeile vorbereiten links
+ if(!nDeltaYLeft && nDeltaYRight)
+ {
+ // Links ist zuende, lade neu mit Rest nach rechts
+ nDeltaYLeft = nDeltaYRight;
+ LoadLeft(nDeltaYLeft);
+ }
+
+ // naechste Zeile rechts
+ if(nDeltaYRight || nDeltaYLeft)
+ {
+ nDeltaYRight--;
+ NextStepRight();
+
+ nDeltaYLeft--;
+ NextStepLeft();
+
+ nYLine++;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void Base3DDefault::DrawLinePhongTexture(long nYPos, B3dMaterial& rMat)
+{
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && (nYPos < aDefaultScissorRectangle.Top()
+ || nYPos > aDefaultScissorRectangle.Bottom()))
+ return;
+
+ // Von links bis rechts zeichnen
+ long nXLineStart = aIntXPosLeft.GetLongValue();
+ long nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
+
+ if(nXLineDelta > 0)
+ {
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
+ || nXLineStart > aDefaultScissorRectangle.Right()))
+ return;
+
+ Vector3D aVectorLeft;
+ aIntVectorLeft.GetVector3DValue(aVectorLeft);
+ Vector3D aVectorRight;
+ aIntVectorRight.GetVector3DValue(aVectorRight);
+ aIntVectorLine.Load(aVectorLeft, aVectorRight, nXLineDelta);
+ aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
+
+ // Texturkoordinateninterpolation?
+ if(bTextureUsed)
+ {
+ aIntTexSLine.Load(aIntTexSLeft.GetDoubleValue(), aIntTexSRight.GetDoubleValue(), nXLineDelta);
+ aIntTexTLine.Load(aIntTexTLeft.GetDoubleValue(), aIntTexTRight.GetDoubleValue(), nXLineDelta);
+ }
+
+ if(GetTransformationSet())
+ {
+ Vector3D aInvTrans = GetTransformationSet()->GetTranslate();
+ Vector3D aInvScale = GetTransformationSet()->GetScale();
+
+ while(nXLineDelta--)
+ {
+ // Werte vorbereiten
+ UINT32 nDepth = aIntDepthLine.GetUINT32Value();
+
+ // Punkt ausgeben
+ if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
+ {
+ Point aTmpPoint(nXLineStart, nYPos);
+ Vector3D aPoint = Get3DCoor(aTmpPoint, nDepth);
+ aPoint -= aInvTrans;
+ aPoint /= aInvScale;
+ Vector3D aNormal;
+ aIntVectorLine.GetVector3DValue(aNormal);
+ aNormal.Normalize();
+ Color aCol = SolveColorModel(rMat, aNormal, aPoint);
+
+ // Texturkoordinateninterpolation?
+ if(bTextureUsed)
+ {
+ GetActiveTexture()->ModifyColor(aCol,
+ aIntTexSLine.GetDoubleValue(),
+ aIntTexTLine.GetDoubleValue());
+ }
+ WritePixel(nXLineStart, nYPos, aCol, nDepth);
+ }
+
+ if(nXLineDelta)
+ {
+ // naechste Spalte
+ nXLineStart++;
+
+ // naechste Tiefe und Farbe
+ aIntDepthLine.Increment();
+ aIntVectorLine.Increment();
+
+ // Texturkoordinateninterpolation?
+ if(bTextureUsed)
+ {
+ aIntTexSLine.Increment();
+ aIntTexTLine.Increment();
+ }
+ }
+ }
+ }
+ }
+}
+
+void Base3DDefault::DrawLinePhong(long nYPos, B3dMaterial& rMat)
+{
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && (nYPos < aDefaultScissorRectangle.Top()
+ || nYPos > aDefaultScissorRectangle.Bottom()))
+ return;
+
+ // Von links bis rechts zeichnen
+ long nXLineStart = aIntXPosLeft.GetLongValue();
+ long nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
+
+ if(nXLineDelta > 0)
+ {
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
+ || nXLineStart > aDefaultScissorRectangle.Right()))
+ return;
+
+ Vector3D aVectorLeft;
+ aIntVectorLeft.GetVector3DValue(aVectorLeft);
+ Vector3D aVectorRight;
+ aIntVectorRight.GetVector3DValue(aVectorRight);
+ aIntVectorLine.Load(aVectorLeft, aVectorRight, nXLineDelta);
+ aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
+
+ if(GetTransformationSet())
+ {
+ Vector3D aInvTrans = GetTransformationSet()->GetTranslate();
+ Vector3D aInvScale = GetTransformationSet()->GetScale();
+ while(nXLineDelta--)
+ {
+ // Werte vorbereiten
+ UINT32 nDepth = aIntDepthLine.GetUINT32Value();
+
+ // Punkt ausgeben
+ if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
+ {
+ Point aTmpPoint(nXLineStart, nYPos);
+ Vector3D aPoint = Get3DCoor(aTmpPoint, nDepth);
+ aPoint -= aInvTrans;
+ aPoint /= aInvScale;
+ Vector3D aNormal;
+ aIntVectorLine.GetVector3DValue(aNormal);
+ aNormal.Normalize();
+ Color aCol = SolveColorModel(rMat, aNormal, aPoint);
+ WritePixel(nXLineStart, nYPos, aCol, nDepth);
+ }
+
+ if(nXLineDelta)
+ {
+ // naechste Spalte
+ nXLineStart++;
+
+ // naechste Tiefe und Farbe
+ aIntDepthLine.Increment();
+ aIntVectorLine.Increment();
+ }
+ }
+ }
+ }
+}
+
+void Base3DDefault::DrawLineColorTexture(long nYPos)
+{
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && (nYPos < aDefaultScissorRectangle.Top()
+ || nYPos > aDefaultScissorRectangle.Bottom()))
+ return;
+
+ // Von links bis rechts zeichnen
+ long nXLineStart = aIntXPosLeft.GetLongValue();
+ long nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
+
+ if(nXLineDelta > 0)
+ {
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
+ || nXLineStart > aDefaultScissorRectangle.Right()))
+ return;
+
+ aIntColorLine.Load(aIntColorLeft.GetColorValue(), aIntColorRight.GetColorValue(), nXLineDelta);
+ aIntTexSLine.Load(aIntTexSLeft.GetDoubleValue(), aIntTexSRight.GetDoubleValue(), nXLineDelta);
+ aIntTexTLine.Load(aIntTexTLeft.GetDoubleValue(), aIntTexTRight.GetDoubleValue(), nXLineDelta);
+ aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
+
+ while(nXLineDelta--)
+ {
+ // Werte vorbereiten
+ UINT32 nDepth = aIntDepthLine.GetUINT32Value();
+
+ // Punkt ausgeben
+ if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
+ {
+ Color aCol = aIntColorLine.GetColorValue();
+ GetActiveTexture()->ModifyColor(aCol,
+ aIntTexSLine.GetDoubleValue(),
+ aIntTexTLine.GetDoubleValue());
+ WritePixel(nXLineStart, nYPos, aCol, nDepth);
+ }
+
+ if(nXLineDelta)
+ {
+ // naechste Spalte
+ nXLineStart++;
+
+ // naechste Tiefe und Farbe
+ aIntDepthLine.Increment();
+ aIntColorLine.Increment();
+ aIntTexSLine.Increment();
+ aIntTexTLine.Increment();
+ }
+ }
+ }
+}
+
+void Base3DDefault::DrawLineColor(long nYPos)
+{
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && (nYPos < aDefaultScissorRectangle.Top()
+ || nYPos > aDefaultScissorRectangle.Bottom()))
+ return;
+
+ // Von links bis rechts zeichnen
+ long nXLineStart = aIntXPosLeft.GetLongValue();
+ long nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
+
+ if(nXLineDelta > 0)
+ {
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
+ || nXLineStart > aDefaultScissorRectangle.Right()))
+ return;
+
+ aIntColorLine.Load(aIntColorLeft.GetColorValue(), aIntColorRight.GetColorValue(), nXLineDelta);
+ aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
+
+ while(nXLineDelta--)
+ {
+ // Werte vorbereiten
+ UINT32 nDepth = aIntDepthLine.GetUINT32Value();
+
+ // Punkt ausgeben
+ if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
+ WritePixel(nXLineStart, nYPos, aIntColorLine.GetColorValue(), nDepth);
+
+ if(nXLineDelta)
+ {
+ // naechste Spalte
+ nXLineStart++;
+
+ // naechste Tiefe und Farbe
+ aIntDepthLine.Increment();
+ aIntColorLine.Increment();
+ }
+ }
+ }
+}
+
+void Base3DDefault::DrawLineTexture(long nYPos, Color& rCol)
+{
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && (nYPos < aDefaultScissorRectangle.Top()
+ || nYPos > aDefaultScissorRectangle.Bottom()))
+ return;
+
+ // Von links bis rechts zeichnen
+ long nXLineStart = aIntXPosLeft.GetLongValue();
+ long nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
+
+ if(nXLineDelta > 0)
+ {
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
+ || nXLineStart > aDefaultScissorRectangle.Right()))
+ return;
+
+ aIntTexSLine.Load(aIntTexSLeft.GetDoubleValue(), aIntTexSRight.GetDoubleValue(), nXLineDelta);
+ aIntTexTLine.Load(aIntTexTLeft.GetDoubleValue(), aIntTexTRight.GetDoubleValue(), nXLineDelta);
+ aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
+
+ while(nXLineDelta--)
+ {
+ // Werte vorbereiten
+ UINT32 nDepth = aIntDepthLine.GetUINT32Value();
+
+ // Punkt ausgeben
+ if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
+ {
+ // Texturkoordinateninterpolation?
+ Color aCol = rCol;
+ GetActiveTexture()->ModifyColor(aCol,
+ aIntTexSLine.GetDoubleValue(),
+ aIntTexTLine.GetDoubleValue());
+ WritePixel(nXLineStart, nYPos, aCol, nDepth);
+ }
+
+ if(nXLineDelta)
+ {
+ // naechste Spalte
+ nXLineStart++;
+
+ // naechste Tiefe und Farbe
+ aIntDepthLine.Increment();
+ aIntTexSLine.Increment();
+ aIntTexTLine.Increment();
+ }
+ }
+ }
+}
+
+void Base3DDefault::DrawLine(long nYPos, Color& rCol)
+{
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && (nYPos < aDefaultScissorRectangle.Top()
+ || nYPos > aDefaultScissorRectangle.Bottom()))
+ return;
+
+ // Von links bis rechts zeichnen
+ long nXLineStart = aIntXPosLeft.GetLongValue();
+ long nXLineDelta = aIntXPosRight.GetLongValue() - nXLineStart;
+
+ if(nXLineDelta > 0)
+ {
+ // Ausserhalb des Clipping-Bereichs?
+ if(IsScissorRegionActive()
+ && ( nXLineStart+nXLineDelta < aDefaultScissorRectangle.Left()
+ || nXLineStart > aDefaultScissorRectangle.Right()))
+ return;
+
+ aIntDepthLine.Load(aIntDepthLeft.GetDoubleValue(), aIntDepthRight.GetDoubleValue(), nXLineDelta);
+
+ while(nXLineDelta--)
+ {
+ // Werte vorbereiten
+ UINT32 nDepth = aIntDepthLine.GetUINT32Value();
+
+ // Punkt ausgeben
+ if(IsVisibleAndScissor(nXLineStart, nYPos, nDepth))
+ WritePixel(nXLineStart, nYPos, rCol, nDepth);
+
+ if(nXLineDelta)
+ {
+ // naechste Spalte
+ nXLineStart++;
+
+ // naechste Tiefe und Farbe
+ aIntDepthLine.Increment();
+ }
+ }
+ }
+}
+
+void Base3DDefault::LoadLeftTexture(long nSize)
+{
+ aIntXPosLeft.Load(aOutPointLeft.X(), aOutPointRight.X(), nSize);
+ aIntDepthLeft.Load(pEntLeft->Point().Z(), pEntRight->Point().Z(), nSize);
+ aIntTexSLeft.Load(
+ pEntLeft->TexCoor().X() * fTexWidth,
+ pEntRight->TexCoor().X() * fTexWidth, nSize);
+ aIntTexTLeft.Load(
+ pEntLeft->TexCoor().Y() * fTexHeight,
+ pEntRight->TexCoor().Y() * fTexHeight, nSize);
+}
+
+void Base3DDefault::LoadLeft(long nSize)
+{
+ aIntXPosLeft.Load(aOutPointLeft.X(), aOutPointRight.X(), nSize);
+ aIntDepthLeft.Load(pEntLeft->Point().Z(), pEntRight->Point().Z(), nSize);
+}
+
+void Base3DDefault::LoadRightTexture(long nSize)
+{
+ aIntXPosRight.Load(aOutPointRight.X(), aOutPointLeft.X(), nSize);
+ aIntDepthRight.Load(pEntRight->Point().Z(), pEntLeft->Point().Z(), nSize);
+ aIntTexSRight.Load(
+ pEntRight->TexCoor().X() * fTexWidth,
+ pEntLeft->TexCoor().X() * fTexWidth, nSize);
+ aIntTexTRight.Load(
+ pEntRight->TexCoor().Y() * fTexHeight,
+ pEntLeft->TexCoor().Y() * fTexHeight, nSize);
+}
+
+void Base3DDefault::LoadRight(long nSize)
+{
+ aIntXPosRight.Load(aOutPointRight.X(), aOutPointLeft.X(), nSize);
+ aIntDepthRight.Load(pEntRight->Point().Z(), pEntLeft->Point().Z(), nSize);
+}
+
+void Base3DDefault::NextStepRightTexture()
+{
+ aIntXPosRight.Increment();
+ aIntDepthRight.Increment();
+ aIntTexSRight.Increment();
+ aIntTexTRight.Increment();
+}
+
+void Base3DDefault::NextStepRight()
+{
+ aIntXPosRight.Increment();
+ aIntDepthRight.Increment();
+}
+
+void Base3DDefault::NextStepLeftTexture()
+{
+ aIntXPosLeft.Increment();
+ aIntDepthLeft.Increment();
+ aIntTexSLeft.Increment();
+ aIntTexTLeft.Increment();
+}
+
+void Base3DDefault::NextStepLeft()
+{
+ aIntXPosLeft.Increment();
+ aIntDepthLeft.Increment();
+}
+
diff --git a/goodies/source/base3d/b3ddeflt.hxx b/goodies/source/base3d/b3ddeflt.hxx
new file mode 100644
index 000000000000..be022af8b0f2
--- /dev/null
+++ b/goodies/source/base3d/b3ddeflt.hxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3ddeflt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DDEFLT_HXX
+#define _B3D_B3DDEFLT_HXX
+
+#ifndef _B3D_B3DCOMMN_HXX
+#include "b3dcommn.hxx"
+#endif
+
+#ifndef _SV_BITMAP_HXX
+#include
+#endif
+
+#ifndef _SV_SALBTYPE_HXX
+#include
+#endif
+
+#ifndef _SV_ALPHA_HXX
+#include
+#endif
+
+#ifndef _BXD_INTERPOLATOR_HXX
+#include "bxdintpo.hxx"
+#endif
+
+/*************************************************************************
+|*
+|* Die Basisklasse fuer Standard 3D Ausgaben auf StarView Basis
+|*
+\************************************************************************/
+
+class Base3DDefault : public Base3DCommon
+{
+private:
+ // ZBuffer auch als BitMap
+ Bitmap aZBuffer;
+
+ // Bitmap zum Zeichnen im Hintergrund
+ Bitmap aPicture;
+
+ // Bitmaps fuer die Transparenz
+ Bitmap aMonoTransparence;
+ AlphaMask aAlphaTransparence;
+
+ // Position der oberen linken Ecke aus ImplSetViewport
+ Rectangle aSizePixel;
+
+ // Mit faktoren umgerechnete echte Bitmap-Groesse
+ Rectangle aLocalSizePixel;
+
+ // ZBuffer loeschwert
+ BitmapColor aClearValue;
+
+ // Zugriffe auf die BitMaps
+ BitmapWriteAccess* pZBufferWrite;
+ BitmapWriteAccess* pPictureWrite;
+ BitmapWriteAccess* pTransparenceWrite;
+
+ // Vergroeberungsstufe und dazugehoerige Variablen
+ double fDetail;
+ double fDetailBackup;
+ long nMaxPixels;
+
+ // Groesse der Textur, falls benutzt
+ double fTexWidth;
+ double fTexHeight;
+
+ // Punktkoodinaten fuer Primitive
+ Point aOutPointTop;
+ Point aOutPointLeft;
+ Point aOutPointRight;
+
+ // Zeiger auf die Ursprungsdaten
+ B3dEntity* pEntTop;
+ B3dEntity* pEntLeft;
+ B3dEntity* pEntRight;
+
+ // benoetigte Interpolatoren
+ BxdInterpolator aIntXPosLeft;
+ BxdInterpolator aIntXPosRight;
+ BxdInterpolator aIntDepthLeft;
+ BxdInterpolator aIntDepthRight;
+ BxdInterpolator aIntDepthLine;
+ BxdInterpolator aIntTexSLeft;
+ BxdInterpolator aIntTexSRight;
+ BxdInterpolator aIntTexTLeft;
+ BxdInterpolator aIntTexTRight;
+ BxdInterpolator aIntTexSLine;
+ BxdInterpolator aIntTexTLine;
+ B3dVectorInterpolator aIntVectorLeft;
+ B3dVectorInterpolator aIntVectorRight;
+ B3dVectorInterpolator aIntVectorLine;
+ BxdColorInterpolator aIntColorLeft;
+ BxdColorInterpolator aIntColorRight;
+ BxdColorInterpolator aIntColorLine;
+
+ // Lokale Scissor Region (ohne TopLeft)
+ Rectangle aDefaultScissorRectangle;
+
+ // Booleans fuer Zeichenoperationen
+ unsigned bNormalsUsed : 1;
+ unsigned bTextureUsed : 1;
+
+ // Bool fuer Detailreduzierung
+ unsigned bReducedDetail : 1;
+ unsigned bDetailBackedup : 1;
+
+ // Funktionen fuer erlangen/freigeben der BitmapAccesses
+ void AcquireAccess();
+ void ReleaseAccess();
+
+ // Umrechnung auf PixelCoor der Bitmaps und zurueck
+ Point GetPixelCoor(B3dEntity& rEntity);
+ Vector3D Get3DCoor(Point& rPnt, double fDepth);
+
+ // ZBuffer funktionen
+ inline BOOL IsInScissorRegion(long nX, long nY);
+ inline BOOL IsVisibleAndScissor(long nX, long nY, UINT32 nDepth);
+ inline void WritePixel(long nX, long nY, Color aColor, UINT32 nDepth);
+
+ // Zeilenerzeuger fuer Polygon
+ /*inline*/ void DrawLinePhongTexture(long nYPos, B3dMaterial& rMat);
+ /*inline*/ void DrawLinePhong(long nYPos, B3dMaterial& rMat);
+ /*inline*/ void DrawLineColorTexture(long nYPos);
+ /*inline*/ void DrawLineColor(long nYPos);
+ /*inline*/ void DrawLineTexture(long nYPos, Color& rCol);
+ /*inline*/ void DrawLine(long nYPos, Color& rCol);
+
+ inline void LoadLeft(long nSize);
+ inline void LoadLeftTexture(long nSize);
+ inline void LoadRight(long nSize);
+ inline void LoadRightTexture(long nSize);
+
+ inline void NextStepRight();
+ inline void NextStepRightTexture();
+ inline void NextStepLeft();
+ inline void NextStepLeftTexture();
+
+public:
+ Base3DDefault(OutputDevice* pOutDev);
+ virtual ~Base3DDefault();
+
+ // Typbestimmung
+ virtual UINT16 GetBase3DType();
+
+ // Szenenverwaltung
+ virtual void StartScene();
+ virtual void EndScene();
+
+ // Nullwert des ZBuffers setzen
+ void SetClearValue(UINT32 nNew) { aClearValue = Color(nNew); }
+
+ // Detailstufe/Vergroeberung der Ausgabe setzen/lesen
+ void SetDetail(double fNew=1.0);
+ double GetDetail() { return fDetail; }
+ void SetMaxPixels(long nNew=500000) { nMaxPixels = nNew; }
+ long GetMaxPixels() { return nMaxPixels; }
+ virtual void SetDisplayQuality(UINT8 nNew);
+
+ // Callbacks bei Matrixaenderungen
+ virtual void SetTransformationSet(B3dTransformationSet* pSet);
+
+protected:
+
+ // Geometrie
+ virtual void Clipped3DPoint(UINT32 nInd);
+ virtual void Clipped3DLine(UINT32 nInd1, UINT32 nInd2);
+ virtual void Clipped3DTriangle(UINT32 nInd1, UINT32 nInd2,
+ UINT32 nInd3);
+};
+
+
+
+#endif // _B3D_B3DDEFLT_HXX
diff --git a/goodies/source/base3d/b3dentty.cxx b/goodies/source/base3d/b3dentty.cxx
new file mode 100644
index 000000000000..f3ad576cfdce
--- /dev/null
+++ b/goodies/source/base3d/b3dentty.cxx
@@ -0,0 +1,366 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dentty.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DENTITY_HXX
+#include "b3dentty.hxx"
+#endif
+
+#ifndef _B3D_B3DCOMMN_HXX
+#include "b3dcommn.hxx"
+#endif
+
+#ifndef _B3D_B3DTRANS_HXX
+#include "b3dtrans.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Kopieren eine 3DEntity
+|*
+\************************************************************************/
+
+void B3dEntity::Copy(B3dEntity& rEnt)
+{
+ aPoint = rEnt.Point();
+ bDeviceCoor = rEnt.IsDeviceCoor();
+ bValid = rEnt.IsValid();
+ bEdgeFlag = rEnt.IsEdgeVisible();
+ aPlaneNormal = rEnt.PlaneNormal();
+
+ if(bNormalUsed = rEnt.IsNormalUsed())
+ aNormal = rEnt.Normal();
+
+ if(bTexCoorUsed = rEnt.IsTexCoorUsed())
+ aTexCoor = rEnt.TexCoor();
+
+ aColor = rEnt.Color();
+}
+
+/*************************************************************************
+|*
+|* Flags auf Ausgangsposition
+|*
+\************************************************************************/
+
+void B3dEntity::Reset()
+{
+ bValid = bNormalUsed = bTexCoorUsed = bDeviceCoor = FALSE;
+ bEdgeFlag = TRUE;
+}
+
+/*************************************************************************
+|*
+|* Device Koordinaten des Punktes berechnen
+|*
+\************************************************************************/
+
+void B3dEntity::ImplToDeviceCoor(B3dTransformationSet* pSet)
+{
+ if(pSet && !bDeviceCoor)
+ {
+ const Vector3D& rScale = pSet->GetScale();
+ const Vector3D& rTrans = pSet->GetTranslate();
+
+ aPoint.Homogenize();
+ aPoint[0] = (aPoint[0] * rScale[0]) + rTrans[0];
+ aPoint[1] = (aPoint[1] * rScale[1]) + rTrans[1];
+ aPoint[2] = (aPoint[2] * rScale[2]) + rTrans[2];
+
+ bDeviceCoor = TRUE;
+ }
+}
+
+/*************************************************************************
+|*
+|* aus Device Koordinaten des Punktes 3D Koor im canonical view volume
+|* berechnen
+|*
+\************************************************************************/
+
+void B3dEntity::ImplTo3DCoor(B3dTransformationSet* pSet)
+{
+ if(pSet && bDeviceCoor)
+ {
+ const Vector3D& rScale = pSet->GetScale();
+ const Vector3D& rTrans = pSet->GetTranslate();
+
+ aPoint.Homogenize();
+ if(rScale[0] != 0.0)
+ aPoint[0] = (aPoint[0] - rTrans[0]) / rScale[0];
+ if(rScale[1] != 0.0)
+ aPoint[1] = (aPoint[1] - rTrans[1]) / rScale[1];
+ if(rScale[2] != 0.0)
+ aPoint[2] = (aPoint[2] - rTrans[2]) / rScale[2];
+
+ bDeviceCoor = FALSE;
+ }
+}
+
+/*************************************************************************
+|*
+|* Garantiere eine gemeinsame Datenbasis (ClipKoordinaten oder
+|* Devicekoordinaten)
+|*
+\************************************************************************/
+
+void B3dEntity::ForceEqualBase(B3dTransformationSet* pSet, B3dEntity& rOld)
+{
+ if(IsDeviceCoor() && rOld.IsDeviceCoor())
+ {
+ SetDeviceCoor();
+ }
+ else
+ {
+ if(IsDeviceCoor())
+ To3DCoor(pSet);
+ if(rOld.IsDeviceCoor())
+ rOld.To3DCoor(pSet);
+ }
+}
+
+/*************************************************************************
+|*
+|* Garantiere eine gemeinsame Datenbasis (ClipKoordinaten oder
+|* Devicekoordinaten)
+|*
+\************************************************************************/
+
+void B3dEntity::ForceEqualBase(B3dTransformationSet* pSet, B3dEntity& rOld1,
+ B3dEntity& rOld2)
+{
+ if(!IsDeviceCoor() && rOld1.IsDeviceCoor() && rOld2.IsDeviceCoor())
+ {
+ if(IsDeviceCoor())
+ To3DCoor(pSet);
+ if(rOld1.IsDeviceCoor())
+ rOld1.To3DCoor(pSet);
+ if(rOld2.IsDeviceCoor())
+ rOld2.To3DCoor(pSet);
+ }
+}
+
+/*************************************************************************
+|*
+|* Neuen Punkt an der stelle t des parametrisierten Vektors rOld1, rOld2
+|* berechnen und fuellen
+|*
+\************************************************************************/
+
+void B3dEntity::CalcInBetween(B3dEntity& rOld1, B3dEntity& rOld2, double t)
+{
+ // DeviceCoor der ersten Quelle benutzen, die Basis sollte
+ // vorher abgeglichen sein
+ SetDeviceCoor(rOld1.IsDeviceCoor());
+
+ // Punktkoordinaten berechnen
+ aPoint.CalcInBetween(rOld1.Point(), rOld2.Point(), t);
+ SetValid();
+
+ // PlaneNormal Koordinaten berechnen
+ rOld1.PlaneNormal().Normalize();
+ rOld2.PlaneNormal().Normalize();
+ aPlaneNormal.CalcInBetween(rOld1.PlaneNormal(), rOld2.PlaneNormal(), t);
+ aPlaneNormal.Normalize();
+
+ // Vektor berechnen
+ if(rOld1.IsNormalUsed() && rOld2.IsNormalUsed())
+ {
+ rOld1.Normal().Normalize();
+ rOld2.Normal().Normalize();
+ aNormal.CalcInBetween(rOld1.Normal(), rOld2.Normal(), t);
+ aNormal.Normalize();
+ SetNormalUsed();
+ }
+
+ // Texturkoordinaten berechnen
+ if(rOld1.IsTexCoorUsed() && rOld2.IsTexCoorUsed())
+ {
+ aTexCoor.CalcInBetween(rOld1.TexCoor(), rOld2.TexCoor(), t);
+ SetTexCoorUsed();
+ }
+
+ // EdgeVisible berechnen
+ SetEdgeVisible(rOld1.IsEdgeVisible());
+
+ // Farbe berechnen
+ aColor.CalcInBetween(rOld1.Color(), rOld2.Color(), t);
+}
+
+/*************************************************************************
+|*
+|* Neuen Punkt in der Mitte des parametrisierten Vektors rOld1, rOld2
+|* berechnen und fuellen
+|*
+\************************************************************************/
+
+void B3dEntity::CalcMiddle(B3dEntity& rOld1, B3dEntity& rOld2)
+{
+ // DeviceCoor der ersten Quelle benutzen, die Basis sollte
+ // vorher abgeglichen sein
+ SetDeviceCoor(rOld1.IsDeviceCoor());
+
+ // Punktkoordinaten berechnen
+ aPoint.CalcMiddle(rOld1.Point(), rOld2.Point());
+ SetValid();
+
+ // PlaneNormal Koordinaten berechnen
+ rOld1.PlaneNormal().Normalize();
+ rOld2.PlaneNormal().Normalize();
+ aPlaneNormal.CalcMiddle(rOld1.PlaneNormal(), rOld2.PlaneNormal());
+ aPlaneNormal.Normalize();
+
+ // Vektor berechnen
+ if(rOld1.IsNormalUsed() && rOld2.IsNormalUsed())
+ {
+ rOld1.Normal().Normalize();
+ rOld2.Normal().Normalize();
+ aNormal.CalcMiddle(rOld1.Normal(), rOld2.Normal());
+ aNormal.Normalize();
+ SetNormalUsed();
+ }
+
+ // Texturkoordinaten berechnen
+ if(rOld1.IsTexCoorUsed() && rOld2.IsTexCoorUsed())
+ {
+ aTexCoor.CalcMiddle(rOld1.TexCoor(), rOld2.TexCoor());
+ SetTexCoorUsed();
+ }
+
+ // EdgeVisible berechnen
+ SetEdgeVisible(rOld1.IsEdgeVisible());
+
+ // Farbe berechnen
+ aColor.CalcMiddle(rOld1.Color(), rOld2.Color());
+}
+
+/*************************************************************************
+|*
+|* Neuen Punkt in der Mitte des Dreiecks rOld1, rOld2, rOld3
+|* berechnen und fuellen
+|*
+\************************************************************************/
+
+void B3dEntity::CalcMiddle(B3dEntity& rOld1, B3dEntity& rOld2,
+ B3dEntity& rOld3)
+{
+ // DeviceCoor der ersten Quelle benutzen, die Basis sollte
+ // vorher abgeglichen sein
+ SetDeviceCoor(rOld1.IsDeviceCoor());
+
+ // Punktkoordinaten berechnen
+ aPoint.CalcMiddle(rOld1.Point(), rOld2.Point(), rOld3.Point());
+ SetValid();
+
+ // PlaneNormal Koordinaten berechnen
+ rOld1.PlaneNormal().Normalize();
+ rOld2.PlaneNormal().Normalize();
+ rOld3.PlaneNormal().Normalize();
+ aPlaneNormal.CalcMiddle(rOld1.PlaneNormal(), rOld2.PlaneNormal(), rOld3.PlaneNormal());
+ aPlaneNormal.Normalize();
+
+ // Vektor berechnen
+ if(rOld1.IsNormalUsed() && rOld2.IsNormalUsed() && rOld3.IsNormalUsed())
+ {
+ rOld1.Normal().Normalize();
+ rOld2.Normal().Normalize();
+ rOld3.Normal().Normalize();
+ aNormal.CalcMiddle(rOld1.Normal(), rOld2.Normal(), rOld3.Normal());
+ aNormal.Normalize();
+ SetNormalUsed();
+ }
+
+ // Texturkoordinaten berechnen
+ if(rOld1.IsTexCoorUsed() && rOld2.IsTexCoorUsed() && rOld3.IsTexCoorUsed())
+ {
+ aTexCoor.CalcMiddle(rOld1.TexCoor(), rOld2.TexCoor(), rOld3.TexCoor());
+ SetTexCoorUsed();
+ }
+
+ // Farbe berechnen
+ aColor.CalcMiddle(rOld1.Color(), rOld2.Color(), rOld3.Color());
+}
+
+/*************************************************************************
+|*
+|* Eine beliebige Transformation auf die Geometrie anwenden
+|*
+\************************************************************************/
+
+void B3dEntity::Transform(const Matrix4D& rMat)
+{
+ aPoint *= rMat;
+ if(bNormalUsed)
+ rMat.RotateAndNormalize(aNormal);
+}
+
+/*************************************************************************
+|*
+|* Bucket fuer geometrische Daten
+|*
+\************************************************************************/
+
+BASE3D_IMPL_BUCKET(B3dEntity, Bucket)
+
+
diff --git a/goodies/source/base3d/b3dgeom.cxx b/goodies/source/base3d/b3dgeom.cxx
new file mode 100644
index 000000000000..a9f4c271a506
--- /dev/null
+++ b/goodies/source/base3d/b3dgeom.cxx
@@ -0,0 +1,982 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dgeom.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DGEOM_HXX
+#include "b3dgeom.hxx"
+#endif
+
+#ifndef _B3D_B3DCOMPO_HXX
+#include "b3dcompo.hxx"
+#endif
+
+#ifndef _B3D_HMATRIX_HXX
+#include "hmatrix.hxx"
+#endif
+
+#ifndef _B3D_BASE3D_HXX
+#include "base3d.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+
+#ifndef _INC_MATH
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Bucket fuer Index
+|*
+\************************************************************************/
+
+BASE3D_IMPL_BUCKET(GeometryIndexValue, Bucket)
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+B3dGeometry::B3dGeometry()
+: pComplexPolygon(NULL),
+ aEntityBucket(14), // 16K
+ aIndexBucket(8) // 256Byte
+{
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Ausgangszustand der Variablen herstellen
+|*
+\************************************************************************/
+
+void B3dGeometry::Reset()
+{
+ bHintIsComplex = FALSE;
+ if(pComplexPolygon)
+ delete pComplexPolygon;
+ pComplexPolygon = NULL;
+}
+
+/*************************************************************************
+|*
+|* Freien Eintrag zum fuellen holen
+|*
+\************************************************************************/
+
+B3dEntity& B3dGeometry::GetFreeEntity()
+{
+ aEntityBucket.Append();
+ return aEntityBucket[aEntityBucket.Count() - 1];
+}
+
+/*************************************************************************
+|*
+|* Inhalte loeschen
+|*
+\************************************************************************/
+
+void B3dGeometry::Erase()
+{
+ aEntityBucket.Erase();
+ aIndexBucket.Erase();
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Inhalte loeschen und Speicher freigeben
+|*
+\************************************************************************/
+
+void B3dGeometry::Empty()
+{
+ aEntityBucket.Empty();
+ aIndexBucket.Empty();
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Start der Geometriebeschreibung
+|*
+\************************************************************************/
+
+void B3dGeometry::StartDescription()
+{
+ Erase();
+}
+
+/*************************************************************************
+|*
+|* Ende der Geometriebeschreibung
+|*
+\************************************************************************/
+
+void B3dGeometry::EndDescription()
+{
+ if(pComplexPolygon)
+ delete pComplexPolygon;
+ pComplexPolygon = NULL;
+}
+
+/*************************************************************************
+|*
+|* Neues Primitiv beginnen
+|*
+\************************************************************************/
+
+void B3dGeometry::StartObject(BOOL bHintComplex, BOOL bOutl)
+{
+ // Hint uebernehmen
+ bHintIsComplex = bHintComplex;
+ bOutline = bOutl;
+
+ // ComplexPolygon anlegen falls nicht vorhanden
+ if(bHintIsComplex)
+ {
+ if(!pComplexPolygon)
+ pComplexPolygon = new B3dComplexPolygon;
+ pComplexPolygon->StartPrimitive();
+ }
+ else
+ {
+ // Direkt neues Polygon beginnen
+ StartPolygon();
+ }
+}
+
+/*************************************************************************
+|*
+|* Primitiv abschliessen
+|*
+\************************************************************************/
+
+void B3dGeometry::EndObject()
+{
+ // Unteren Index holen
+ UINT32 nLow = 0L;
+ if(aIndexBucket.Count())
+ nLow = aIndexBucket[aIndexBucket.Count()-1].GetIndex();
+
+ if(bHintIsComplex)
+ {
+ pComplexPolygon->EndPrimitive(this);
+ }
+ else
+ {
+ // Polygon abschliessen
+ EndPolygon();
+ }
+
+ // EbenenNormale berechnen und setzen; bei Linien und
+ // Punkten wird PlaneNormal auf (0,0,0) gesetzt
+ UINT32 nHigh = aIndexBucket[aIndexBucket.Count()-1].GetIndex();
+ Vector3D aPlaneNormal = -CalcNormal(nLow, nHigh);
+ while(nLow < nHigh)
+ aEntityBucket[nLow++].PlaneNormal() = aPlaneNormal;
+}
+
+/*************************************************************************
+|*
+|* Geometrieuebergabe
+|*
+\************************************************************************/
+
+void B3dGeometry::AddEdge(const Vector3D& rPoint)
+{
+ if(bHintIsComplex)
+ {
+ B3dEntity& rNew = pComplexPolygon->GetFreeEntity();
+
+ rNew.Reset();
+ rNew.Point() = rPoint;
+ rNew.SetValid();
+ rNew.SetEdgeVisible(TRUE);
+
+ pComplexPolygon->PostAddVertex(rNew);
+ }
+ else
+ {
+ B3dEntity& rNew = GetFreeEntity();
+
+ rNew.Reset();
+ rNew.Point() = rPoint;
+ rNew.SetValid();
+ rNew.SetEdgeVisible(TRUE);
+ }
+}
+
+void B3dGeometry::AddEdge(
+ const Vector3D& rPoint,
+ const Vector3D& rNormal)
+{
+ if(bHintIsComplex)
+ {
+ B3dEntity& rNew = pComplexPolygon->GetFreeEntity();
+
+ rNew.Reset();
+ rNew.Point() = rPoint;
+ rNew.SetValid();
+ rNew.Normal() = rNormal;
+ rNew.SetNormalUsed();
+ rNew.SetEdgeVisible(TRUE);
+
+ pComplexPolygon->PostAddVertex(rNew);
+ }
+ else
+ {
+ B3dEntity& rNew = GetFreeEntity();
+
+ rNew.Reset();
+ rNew.Point() = rPoint;
+ rNew.SetValid();
+ rNew.Normal() = rNormal;
+ rNew.SetNormalUsed();
+ rNew.SetEdgeVisible(TRUE);
+ }
+}
+
+void B3dGeometry::AddEdge(
+ const Vector3D& rPoint,
+ const Vector3D& rNormal,
+ const Vector3D& rTexture)
+{
+ if(bHintIsComplex)
+ {
+ B3dEntity& rNew = pComplexPolygon->GetFreeEntity();
+
+ rNew.Reset();
+ rNew.Point() = rPoint;
+ rNew.SetValid();
+ rNew.Normal() = rNormal;
+ rNew.SetNormalUsed();
+ rNew.TexCoor() = rTexture;
+ rNew.SetTexCoorUsed();
+ rNew.SetEdgeVisible(TRUE);
+
+ pComplexPolygon->PostAddVertex(rNew);
+ }
+ else
+ {
+ B3dEntity& rNew = GetFreeEntity();
+
+ rNew.Reset();
+ rNew.Point() = rPoint;
+ rNew.SetValid();
+ rNew.Normal() = rNormal;
+ rNew.SetNormalUsed();
+ rNew.TexCoor() = rTexture;
+ rNew.SetTexCoorUsed();
+ rNew.SetEdgeVisible(TRUE);
+ }
+}
+
+/*************************************************************************
+|*
+|* Copy-Operator
+|*
+\************************************************************************/
+
+void B3dGeometry::operator=(const B3dGeometry& rObj)
+{
+ // Bucket kopieren
+ aEntityBucket = rObj.aEntityBucket;
+ aIndexBucket = rObj.aIndexBucket;
+
+ // ComplexPolygon nicht kopieren
+ pComplexPolygon = NULL;
+
+ // Hint auch nicht
+ bHintIsComplex = FALSE;
+}
+
+/*************************************************************************
+|*
+|* Callbacks bei komplexen Primitiven
+|*
+\************************************************************************/
+
+void B3dGeometry::StartComplexPrimitive()
+{
+ StartPolygon();
+}
+
+void B3dGeometry::EndComplexPrimitive()
+{
+ EndPolygon();
+}
+
+void B3dGeometry::AddComplexVertex(B3dEntity& rNew, BOOL bIsVisible)
+{
+ // Kopieren
+ B3dEntity& rLocal = GetFreeEntity();
+ rLocal = rNew;
+
+ // EdgeFlag anpassen
+ rLocal.SetEdgeVisible(bIsVisible);
+}
+
+/*************************************************************************
+|*
+|* PolygonStart und -Ende aufzeichnen
+|*
+\************************************************************************/
+
+void B3dGeometry::StartPolygon()
+{
+}
+
+void B3dGeometry::EndPolygon()
+{
+ GeometryIndexValue aNewIndex(aEntityBucket.Count());
+ if(bOutline)
+ aNewIndex.SetMode(B3D_INDEX_MODE_LINE);
+ aIndexBucket.Append(aNewIndex);
+}
+
+/*************************************************************************
+|*
+|* Eine beliebige Transformation auf die Geometrie anwenden
+|*
+\************************************************************************/
+
+void B3dGeometry::Transform(const Matrix4D& rMat)
+{
+ for(UINT32 a=0;a SMALL_DVALUE)
+ {
+ fZwi = (-fScalar - (rBack.Scalar(aNormal))) / fZwi;
+// if(fZwi > SMALL_DVALUE && fZwi < 1.0 - SMALL_DVALUE)
+// {
+ rCut.X() = rBack.X() + (aLineVec.X() * fZwi);
+ rCut.Y() = rBack.Y() + (aLineVec.Y() * fZwi);
+ rCut.Z() = rBack.Z() + (aLineVec.Z() * fZwi);
+
+ bCutValid = TRUE;
+// }
+ }
+ return bCutValid;
+}
+
+BOOL B3dGeometry::IsInside(UINT32 nLow, UINT32 nHigh, const Vector3D& rPnt)
+{
+ BOOL bInside(FALSE);
+ B3dVolume aVolume;
+
+ // Volume von genau dieser Flaeche feststellen
+ for(UINT32 a=nLow;a= aVolume.MinVec().X() && rPnt.X() - SMALL_DVALUE <= aVolume.MaxVec().X()
+ && rPnt.Y() + SMALL_DVALUE >= aVolume.MinVec().Y() && rPnt.Y() - SMALL_DVALUE <= aVolume.MaxVec().Y()
+ && rPnt.Z() + SMALL_DVALUE >= aVolume.MinVec().Z() && rPnt.Z() - SMALL_DVALUE <= aVolume.MaxVec().Z());
+
+ if(bIsInside)
+ {
+ BOOL bInsideXY(FALSE);
+ BOOL bInsideXZ(FALSE);
+ BOOL bInsideYZ(FALSE);
+ const Vector3D* pPrev = &(aEntityBucket[nHigh - 1].Point().GetVector3D());
+ const Vector3D* pActual;
+ Vector3D aDiffPrev, aDiffActual;
+
+ while(nLow < nHigh)
+ {
+ // Neuen Punkt holen
+ pActual = &(aEntityBucket[nLow++].Point().GetVector3D());
+
+ // Diffs bilden
+ aDiffPrev = *pPrev - rPnt;
+ aDiffActual = *pActual - rPnt;
+
+ // Ueberschneidung in Y moeglich?
+ if((aDiffPrev.Y() > 0.0 && aDiffActual.Y() <= 0.0) || (aDiffActual.Y() > 0.0 && aDiffPrev.Y() <= 0.0))
+ {
+ // in welchem Bereich liegt X?
+ if(aDiffPrev.X() >= 0.0 && aDiffActual.X() >= 0.0)
+ {
+ // Ueberschneidung
+ bInsideXY = !bInsideXY;
+ }
+ else if((aDiffPrev.X() > 0.0 && aDiffActual.X() <= 0.0) || (aDiffActual.X() > 0.0 && aDiffPrev.X() <= 0.0))
+ {
+ // eventuell Ueberschneidung
+ // wo liegt die X-Koordinate des Schnitts mit der X-Achse?
+ if(aDiffActual.Y() != aDiffPrev.Y())
+ if(aDiffPrev.X() - ((aDiffPrev.Y() * (aDiffActual.X() - aDiffPrev.X())) / (aDiffActual.Y() - aDiffPrev.Y())) >= 0.0)
+ // Ueberschneidung
+ bInsideXY = !bInsideXY;
+ }
+
+ // in welchem Bereich liegt Z?
+ if(aDiffPrev.Z() >= 0.0 && aDiffActual.Z() >= 0.0)
+ {
+ // Ueberschneidung
+ bInsideYZ = !bInsideYZ;
+ }
+ else if((aDiffPrev.Z() > 0.0 && aDiffActual.Z() <= 0.0) || (aDiffActual.Z() > 0.0 && aDiffPrev.Z() <= 0.0))
+ {
+ // eventuell Ueberschneidung
+ // wo liegt die X-Koordinate des Schnitts mit der X-Achse?
+ if(aDiffActual.Y() != aDiffPrev.Y())
+ if(aDiffPrev.Z() - ((aDiffPrev.Y() * (aDiffActual.Z() - aDiffPrev.Z())) / (aDiffActual.Y() - aDiffPrev.Y())) >= 0.0)
+ // Ueberschneidung
+ bInsideYZ = !bInsideYZ;
+ }
+ }
+
+ // Ueberschneidung in X moeglich?
+ if((aDiffPrev.X() > 0.0 && aDiffActual.X() <= 0.0) || (aDiffActual.X() > 0.0 && aDiffPrev.X() <= 0.0))
+ {
+ // in welchem Bereich liegt Z?
+ if(aDiffPrev.Z() >= 0.0 && aDiffActual.Z() >= 0.0)
+ {
+ // Ueberschneidung
+ bInsideXZ = !bInsideXZ;
+ }
+ else if((aDiffPrev.Z() > 0.0 && aDiffActual.Z() <= 0.0) || (aDiffActual.Z() > 0.0 && aDiffPrev.Z() <= 0.0))
+ {
+ // eventuell Ueberschneidung
+ // wo liegt die X-Koordinate des Schnitts mit der X-Achse?
+ if(aDiffActual.X() != aDiffPrev.X())
+ if(aDiffPrev.Z() - ((aDiffPrev.X() * (aDiffActual.Z() - aDiffPrev.Z())) / (aDiffActual.X() - aDiffPrev.X())) >= 0.0)
+ // Ueberschneidung
+ bInsideXZ = !bInsideXZ;
+ }
+ }
+
+ // Punkt als Vorgaenger merken
+ pPrev = pActual;
+ }
+ // Wahrheitswert bilden
+ bInside = bInsideXY || bInsideXZ || bInsideYZ;
+ }
+ return bInside;
+}
+
+/*************************************************************************
+|*
+|* BoundVolume liefern
+|*
+\************************************************************************/
+
+B3dVolume B3dGeometry::GetBoundVolume()
+{
+ B3dVolume aRetval;
+
+ for(UINT32 a=0;a fXCenter + 0.5)
+ fXPoint -= 1.0;
+ if(fXPoint < fXCenter - 0.5)
+ fXPoint += 1.0;
+
+ // Polarkoordinaten als Texturkoordinaten zuweisen
+ if(nCreateWhat & B3D_CREATE_DEFAULT_X)
+ aEntityBucket[nPointCounter].TexCoor().X() = fXPoint;
+ if(nCreateWhat & B3D_CREATE_DEFAULT_Y)
+ aEntityBucket[nPointCounter].TexCoor().Y() = fYPoint;
+ if(nCreateWhat & B3D_CREATE_DEFAULT_Z)
+ aEntityBucket[nPointCounter].TexCoor().Z() = 0.0;
+
+ aEntityBucket[nPointCounter++].SetTexCoorUsed(TRUE);
+ }
+
+ // Punkte korrigieren, die direkt in den Polarregionen liegen. Deren
+ // X-Koordinate kann nicht korrekt sein. Die korrekte X-Koordinate
+ // ist diejenige des Punktes, der in den Pol hinein oder aus diesem heraus
+ // fuehrt, auf der Kugel also direkt darauf zu.
+ if(nCreateWhat & B3D_CREATE_DEFAULT_X)
+ {
+ nPointCounter = nRememberPointCounter;
+ while(nPointCounter < aIndexBucket[a].GetIndex())
+ {
+ Vector3D& aCoor = aEntityBucket[nPointCounter].TexCoor();
+ if(fabs(aCoor.Y()) < SMALL_DVALUE || fabs(aCoor.Y() - 1.0) < SMALL_DVALUE)
+ {
+ // Nachfolger finden
+ UINT32 nNextIndex = (nPointCounter + 1 < aIndexBucket[a].GetIndex())
+ ? nPointCounter + 1 : nRememberPointCounter;
+ Vector3D& aNextCoor = aEntityBucket[nNextIndex].TexCoor();
+
+ // Vorgaenger finden
+ UINT32 nPrevIndex = (nPointCounter && nPointCounter - 1 >= nRememberPointCounter)
+ ? nPointCounter - 1 : aIndexBucket[a].GetIndex() - 1;
+ Vector3D& aPrevCoor = aEntityBucket[nPrevIndex].TexCoor();
+
+ // Nachfolger testen: Liegt dieser ausserhalb des Pols?
+ if(fabs(aNextCoor.Y()) > SMALL_DVALUE && fabs(aNextCoor.Y() - 1.0) > SMALL_DVALUE)
+ {
+ // falls ja: X-Koordinate uebernehmen
+ aCoor.X() = aNextCoor.X();
+ }
+ // Vorgaenger testen: Liegt dieser ausserhalb des Pols?
+ else if(fabs(aPrevCoor.Y()) > SMALL_DVALUE && fabs(aPrevCoor.Y() - 1.0) > SMALL_DVALUE)
+ {
+ // falls ja, X-Koordinate uebernehmen
+ aCoor.X() = aPrevCoor.X();
+ }
+ else
+ {
+ // Weder Vorgaenger noch Nachfolger liegen ausserhalb des Pols.
+ // Uebernimm daher wenigstens den bereits korrigierten X-Wert
+ // des Vorgaengers
+ aCoor.X() = aPrevCoor.X();
+ }
+ }
+ // naechster Punkt
+ nPointCounter++;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Texturkoordinaten als Parallelprojektion auf X,Y,Z - Koordinaten
+ // im Bereich 1.0 bis 0.0 der Geometrie abstellen
+ // Gesamtabmessungen holen
+ B3dVolume aVolume = GetBoundVolume();
+
+ for(UINT32 a=0;a
+#endif
+
+/*************************************************************************
+|*
+|* Konstruktor B3dLight
+|*
+\************************************************************************/
+
+B3dLight::B3dLight()
+{
+}
+
+/*************************************************************************
+|*
+|* Intensitaet einer bestimmten Lichtkomponente setzen
+|*
+\************************************************************************/
+
+void B3dLight::SetIntensity(const Color rNew, Base3DMaterialValue eVal)
+{
+ switch(eVal)
+ {
+ case Base3DMaterialAmbient:
+ {
+ aAmbient = rNew;
+ if(rNew.GetRed() || rNew.GetGreen() || rNew.GetBlue())
+ bIsAmbient = TRUE;
+ else
+ bIsAmbient = FALSE;
+ break;
+ }
+ case Base3DMaterialDiffuse:
+ {
+ aDiffuse = rNew;
+ if(rNew.GetRed() || rNew.GetGreen() || rNew.GetBlue())
+ bIsDiffuse = TRUE;
+ else
+ bIsDiffuse = FALSE;
+ break;
+ }
+ default:
+ {
+ aSpecular = rNew;
+ if(rNew.GetRed() || rNew.GetGreen() || rNew.GetBlue())
+ bIsSpecular = TRUE;
+ else
+ bIsSpecular = FALSE;
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Intensitaet einer bestimmten Lichtkomponente lesen
+|*
+\************************************************************************/
+
+const Color B3dLight::GetIntensity(Base3DMaterialValue eVal)
+{
+ switch(eVal)
+ {
+ case Base3DMaterialAmbient:
+ {
+ return aAmbient;
+ break;
+ }
+ case Base3DMaterialDiffuse:
+ {
+ return aDiffuse;
+ break;
+ }
+ default:
+ {
+ return aSpecular;
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Lichtquelle initialisieren (selbe defaults wie OpenGL)
+|*
+\************************************************************************/
+
+void B3dLight::Init()
+{
+ aAmbient = Color(255, 0, 0, 0);
+ if(IsFirst())
+ {
+ aDiffuse = Color(255, 204, 204, 204);
+ aSpecular = Color(255, 255, 255, 255);
+ aPosition = Vector3D(1.0, 1.0, 1.0);
+ aPosition.Normalize();
+ bIsDiffuse = TRUE;
+ bIsSpecular = TRUE;
+ bIsEnabled = TRUE;
+ }
+ else
+ {
+ aDiffuse = Color(0, 0, 0, 0);
+ aSpecular = Color(0, 0, 0, 0);
+ aPosition = Vector3D(0.0, 0.0, 1.0);
+ bIsDiffuse = FALSE;
+ bIsSpecular = FALSE;
+ bIsEnabled = FALSE;
+ }
+ aPositionEye = Vector3D(0.0, 0.0, 0.0);
+ aSpotDirection = Vector3D(0.0, 0.0, -1.0);
+ aSpotDirectionEye = Vector3D(0.0, 0.0, 0.0);
+ nSpotExponent = 0;
+ fSpotCutoff = 180.0;
+ fConstantAttenuation = 1.0;
+ fLinearAttenuation = 0.0;
+ fQuadraticAttenuation = 0.0;
+ bLinearOrQuadratic = FALSE;
+ bIsDirectionalSource = TRUE;
+ bIsSpot = FALSE;
+ bIsAmbient = FALSE;
+}
+
+/*************************************************************************
+|*
+|* Richtung der Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLight::SetSpotDirection(const Vector3D& rNew)
+{
+ aSpotDirection=rNew;
+ aSpotDirection.Normalize();
+}
+
+/*************************************************************************
+|*
+|* Richtung der Lichtquelle in Augkoordinaten setzen
+|*
+\************************************************************************/
+
+void B3dLight::SetSpotDirectionEye(const Vector3D& rNew)
+{
+ aSpotDirectionEye=rNew;
+ aSpotDirectionEye.Normalize();
+}
+
+/*************************************************************************
+|*
+|* Kegel der Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLight::SetSpotCutoff(double fNew)
+{
+ fSpotCutoff = fNew;
+ bIsSpot = (fNew == 180.0) ? FALSE : TRUE;
+ fCosSpotCutoff = cos(fNew * F_PI180);
+}
+
+/*************************************************************************
+|*
+|* Lineare Attenuation setzen
+|*
+\************************************************************************/
+
+void B3dLight::SetLinearAttenuation(double fNew)
+{
+ fLinearAttenuation = fNew;
+ bLinearOrQuadratic =
+ (fNew + fQuadraticAttenuation == 0.0) ? FALSE : TRUE;
+}
+
+/*************************************************************************
+|*
+|* Quadratische Attenuation setzen
+|*
+\************************************************************************/
+
+void B3dLight::SetQuadraticAttenuation(double fNew)
+{
+ fQuadraticAttenuation = fNew;
+ bLinearOrQuadratic =
+ (fNew + fLinearAttenuation == 0.0) ? FALSE : TRUE;
+}
+
+void B3dLight::WriteData(SvStream& rOut) const
+{
+ rOut << aAmbient;
+ rOut << aDiffuse;
+ rOut << aSpecular;
+
+ rOut << aPosition;
+ rOut << aPositionEye;
+ rOut << aSpotDirection;
+ rOut << aSpotDirectionEye;
+ rOut << nSpotExponent;
+
+ rOut << fSpotCutoff;
+ rOut << fCosSpotCutoff;
+ rOut << fConstantAttenuation;
+ rOut << fLinearAttenuation;
+ rOut << fQuadraticAttenuation;
+
+ rOut << (BOOL)bIsFirstLight;
+ rOut << (BOOL)bIsEnabled;
+ rOut << (BOOL)bIsDirectionalSource;
+ rOut << (BOOL)bIsSpot;
+ rOut << (BOOL)bIsAmbient;
+ rOut << (BOOL)bIsDiffuse;
+ rOut << (BOOL)bIsSpecular;
+ rOut << (BOOL)bLinearOrQuadratic;
+}
+
+void B3dLight::ReadData(SvStream& rIn)
+{
+ BOOL bTmp;
+
+ rIn >> aAmbient;
+ rIn >> aDiffuse;
+ rIn >> aSpecular;
+
+ rIn >> aPosition;
+ rIn >> aPositionEye;
+ rIn >> aSpotDirection;
+ rIn >> aSpotDirectionEye;
+ rIn >> nSpotExponent;
+
+ rIn >> fSpotCutoff;
+ rIn >> fCosSpotCutoff;
+ rIn >> fConstantAttenuation;
+ rIn >> fLinearAttenuation;
+ rIn >> fQuadraticAttenuation;
+
+ rIn >> bTmp; bIsFirstLight = bTmp;
+ rIn >> bTmp; bIsEnabled = bTmp;
+ rIn >> bTmp; bIsDirectionalSource = bTmp;
+ rIn >> bTmp; bIsSpot = bTmp;
+ rIn >> bTmp; bIsAmbient = bTmp;
+ rIn >> bTmp; bIsDiffuse = bTmp;
+ rIn >> bTmp; bIsSpecular = bTmp;
+ rIn >> bTmp; bLinearOrQuadratic = bTmp;
+}
+
+/*************************************************************************
+|*
+|* Gruppe von Lichtquellen, Konstruktor
+|*
+\************************************************************************/
+
+B3dLightGroup::B3dLightGroup()
+: aGlobalAmbientLight(255, 102, 102, 102),
+ bLocalViewer(TRUE),
+ bModelTwoSide(FALSE),
+ bLightingEnabled(TRUE)
+{
+ // Lichtquellen initialisieren
+ for(UINT16 i=0; i < BASE3D_MAX_NUMBER_LIGHTS;i++)
+ {
+ aLight[i].SetFirst(i==0);
+ aLight[i].Init();
+ }
+}
+
+/*************************************************************************
+|*
+|* globales Umgebungslicht setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetGlobalAmbientLight(const Color rNew)
+{
+ if(aGlobalAmbientLight != rNew)
+ {
+ aGlobalAmbientLight = rNew;
+ }
+}
+
+/*************************************************************************
+|*
+|* globales Umgebungslicht lesen
+|*
+\************************************************************************/
+
+const Color B3dLightGroup::GetGlobalAmbientLight()
+{
+ return aGlobalAmbientLight;
+}
+
+/*************************************************************************
+|*
+|* Modus globaler Viewer bei Berechnung specular reflection setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetLocalViewer(BOOL bNew)
+{
+ if(bLocalViewer != bNew)
+ {
+ bLocalViewer = bNew;
+ }
+}
+
+/*************************************************************************
+|*
+|* Modus globaler Viewer bei Berechnung specular reflection lesen
+|*
+\************************************************************************/
+
+BOOL B3dLightGroup::GetLocalViewer()
+{
+ return bLocalViewer;
+}
+
+/*************************************************************************
+|*
+|* Modus Beleuchtungsmodell beidseitig anwenden setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetModelTwoSide(BOOL bNew)
+{
+ if(bModelTwoSide != bNew)
+ {
+ bModelTwoSide = bNew;
+ }
+}
+
+/*************************************************************************
+|*
+|* Modus Beleuchtungsmodell beidseitig anwenden lesen
+|*
+\************************************************************************/
+
+BOOL B3dLightGroup::GetModelTwoSide()
+{
+ return bModelTwoSide;
+}
+
+/*************************************************************************
+|*
+|* Beleuchtungsmodell aktivieren/deaktivieren
+|*
+\************************************************************************/
+
+void B3dLightGroup::EnableLighting(BOOL bNew)
+{
+ if(bLightingEnabled != bNew)
+ {
+ bLightingEnabled = bNew;
+ }
+}
+
+/*************************************************************************
+|*
+|* Abfrage, ob das Beleuchtungsmodell aktiviert/deaktiviert ist
+|*
+\************************************************************************/
+
+BOOL B3dLightGroup::IsLightingEnabled()
+{
+ return bLightingEnabled;
+}
+
+/*************************************************************************
+|*
+|* Die Intensitaet eines bestimmten Aspekts einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetIntensity(const Color rNew,
+ Base3DMaterialValue eMat, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetIntensity(rNew, eMat);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Die Intensitaet eines bestimmten Aspekts einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+const Color B3dLightGroup::GetIntensity(Base3DMaterialValue eMat,
+ Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].GetIntensity(eMat);
+}
+
+/*************************************************************************
+|*
+|* Die Position einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetPosition(const Vector3D& rNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetPosition(rNew);
+ aLight[eNum].SetDirectionalSource(FALSE);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Die Position einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+const Vector3D& B3dLightGroup::GetPosition(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+#ifdef DBG_UTIL
+ if(IsDirectionalSource())
+ DBG_ERROR("Zugriff auf die Position einer gerichteten Lichtquelle!");
+#endif
+ return aLight[eNum].GetPosition();
+}
+
+/*************************************************************************
+|*
+|* Die Richtung einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetDirection(const Vector3D& rNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetPosition(rNew);
+ aLight[eNum].SetDirectionalSource(TRUE);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Die Richtung einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+const Vector3D& B3dLightGroup::GetDirection(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+#ifdef DBG_UTIL
+ if(!IsDirectionalSource())
+ DBG_ERROR("Zugriff auf die Richtung einer ungerichteten Lichtquelle!");
+#endif
+ return aLight[eNum].GetPosition();
+}
+
+/*************************************************************************
+|*
+|* Die Richtung einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetSpotDirection(const Vector3D& rNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetSpotDirection(rNew);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Die Richtung einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+const Vector3D& B3dLightGroup::GetSpotDirection(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].GetSpotDirection();
+}
+
+/*************************************************************************
+|*
+|* Den SpotExponent einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetSpotExponent(UINT16 nNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetSpotExponent(nNew);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Den SpotExponent einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+UINT16 B3dLightGroup::GetSpotExponent(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].GetSpotExponent();
+}
+
+/*************************************************************************
+|*
+|* Die Einengung des Lichtkegels einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetSpotCutoff(double fNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetSpotCutoff(fNew);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Die Einengung des Lichtkegels einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+double B3dLightGroup::GetSpotCutoff(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].GetSpotCutoff();
+}
+
+/*************************************************************************
+|*
+|* Den konstanten AttenuationFactor einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetConstantAttenuation(double fNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetConstantAttenuation(fNew);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Den konstanten AttenuationFactor einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+double B3dLightGroup::GetConstantAttenuation(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].GetConstantAttenuation();
+}
+
+/*************************************************************************
+|*
+|* Den linearen AttenuationFactor einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetLinearAttenuation(double fNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetLinearAttenuation(fNew);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Den linearen AttenuationFactor einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+double B3dLightGroup::GetLinearAttenuation(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].GetLinearAttenuation();
+}
+
+/*************************************************************************
+|*
+|* Den quadratischen AttenuationFactor einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void B3dLightGroup::SetQuadraticAttenuation(double fNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].SetQuadraticAttenuation(fNew);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Den quadratischen AttenuationFactor einer Lichtquelle lesen
+|*
+\************************************************************************/
+
+double B3dLightGroup::GetQuadraticAttenuation(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].GetQuadraticAttenuation();
+}
+
+/*************************************************************************
+|*
+|* Eine Lichtquelle aktivieren/deaktivieren
+|*
+\************************************************************************/
+
+void B3dLightGroup::Enable(BOOL bNew, Base3DLightNumber eNum)
+{
+ if(eNum >= Base3DLight0 && eNum <= Base3DLight7)
+ {
+ aLight[eNum].Enable(bNew);
+ }
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("Access to Light out of range");
+#endif
+}
+
+/*************************************************************************
+|*
+|* Abfrage, ob eine Lichtquelle aktiviert/deaktiviert ist
+|*
+\************************************************************************/
+
+BOOL B3dLightGroup::IsEnabled(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].IsEnabled();
+}
+
+/*************************************************************************
+|*
+|* Abfrage, ob eine Lichtquelle als directional source eingerichtet ist
+|*
+\************************************************************************/
+
+BOOL B3dLightGroup::IsDirectionalSource(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum].IsDirectionalSource();
+}
+
+/*************************************************************************
+|*
+|* Direkter Zugriff auf B3dLight fuer abgeleitete Klassen
+|*
+\************************************************************************/
+
+B3dLight& B3dLightGroup::GetLightObject(Base3DLightNumber eNum)
+{
+ if(eNum < Base3DLight0 || eNum > Base3DLight7)
+ {
+ eNum = Base3DLight0;
+#ifdef DBG_UTIL
+ DBG_ERROR("Access to Light out of range");
+#endif
+ }
+ return aLight[eNum];
+}
+
+void B3dLightGroup::WriteData(SvStream& rOut) const
+{
+ for(UINT16 a=0;aGetLightObject((Base3DLightNumber)(Base3DLight0 + a));
+ rLight.WriteData(rOut);
+ }
+
+ rOut << aGlobalAmbientLight;
+
+ rOut << (BOOL)bLightingEnabled;
+ rOut << (BOOL)bLocalViewer;
+ rOut << (BOOL)bModelTwoSide;
+}
+
+void B3dLightGroup::ReadData(SvStream& rIn)
+{
+ BOOL bTmp;
+
+ for(UINT16 a=0;a> aGlobalAmbientLight;
+
+ rIn >> bTmp; bLightingEnabled = bTmp;
+ rIn >> bTmp; bLocalViewer = bTmp;
+ rIn >> bTmp; bModelTwoSide = bTmp;
+}
+
diff --git a/goodies/source/base3d/b3dopngl.cxx b/goodies/source/base3d/b3dopngl.cxx
new file mode 100644
index 000000000000..e5feb7f41a60
--- /dev/null
+++ b/goodies/source/base3d/b3dopngl.cxx
@@ -0,0 +1,1502 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dopngl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _SV_OUTDEV_HXX
+#include
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+
+#ifndef _B3D_B3DOPNGL_HXX
+#include "b3dopngl.hxx"
+#endif
+
+#ifndef _B3D_HMATRIX_HXX
+#include "hmatrix.hxx"
+#endif
+
+#ifndef _B3D_B3DTEX_HXX
+#include "b3dtex.hxx"
+#endif
+
+#ifndef _B3D_B3DTRANS_HXX
+#include "b3dtrans.hxx"
+#endif
+
+#ifndef _B3D_B3DGEOM_HXX
+#include "b3dgeom.hxx"
+#endif
+
+#ifndef _SFXINIMGR_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Konstruktor Base3DOpenGL
+|*
+\************************************************************************/
+
+Base3DOpenGL::Base3DOpenGL(OutputDevice* pOutDev)
+: Base3D(pOutDev),
+ aOpenGL(pOutDev),
+ aEmptyVector(0.0, 0.0, 0.0),
+ aLastNormal(DBL_MAX, DBL_MAX, DBL_MAX),
+ aLastTexCoor(DBL_MAX, DBL_MAX, DBL_MAX),
+ fOffFacMul100((float)(-0.2 * 100.0)),
+ fOffUniMul100((float)(-1.0 * 100.0)),
+ aPhongBuffer(12), // 4K
+ nPhongDivideSize(20),
+ bForceToSinglePrimitiveOutput(TRUE) // (#70626#)
+{
+ // create OpenGL context for pOutDev; pOutDev is NOT a printer,
+ // so don't care about printers in this place
+ if(aOpenGL.IsValid())
+ {
+ // setup default parameters
+ aOpenGL.ClearDepth( 1.0 );
+ aOpenGL.DepthFunc( GL_LEQUAL );
+ aOpenGL.Enable( GL_DEPTH_TEST );
+ aOpenGL.Enable( GL_DITHER );
+ aOpenGL.Enable( GL_NORMALIZE );
+ aOpenGL.Disable( GL_CULL_FACE );
+ aOpenGL.Disable( GL_LIGHTING );
+ aOpenGL.Disable( GL_LINE_SMOOTH );
+ aOpenGL.Disable( GL_POINT_SMOOTH );
+ aOpenGL.Disable( GL_POLYGON_SMOOTH );
+ aOpenGL.Disable( GL_POLYGON_STIPPLE );
+ aOpenGL.Disable( GL_LINE_STIPPLE );
+ aOpenGL.Disable( GL_TEXTURE_1D );
+ aOpenGL.Disable( GL_TEXTURE_2D );
+ aOpenGL.Disable( GL_BLEND );
+ aOpenGL.DepthMask( GL_TRUE );
+ aOpenGL.ShadeModel( GL_SMOOTH );
+ aOpenGL.EdgeFlag( GL_TRUE );
+ aOpenGL.Disable( GL_SCISSOR_TEST );
+ }
+ SetContextIsValid(aOpenGL.IsValid());
+ CalcInternPhongDivideSize();
+
+ // read bForceToSinglePrimitiveOutput-flag from .ini
+ String aTmp = SfxIniManager::Get()->Get(SFX_KEY_3D_OPENGL_FASTER);
+ bForceToSinglePrimitiveOutput =
+ (aTmp.Len() && aTmp.GetChar(0) == sal_Unicode('0'));
+}
+
+/*************************************************************************
+|*
+|* Typbestimmung
+|*
+\************************************************************************/
+
+UINT16 Base3DOpenGL::GetBase3DType()
+{
+ return BASE3D_TYPE_OPENGL;
+}
+
+/*************************************************************************
+|*
+|* Start der Szenenbeschreibung: Evtl. neuer HDC, Loesche Tiefenbuffer
+|*
+\************************************************************************/
+
+void Base3DOpenGL::StartScene()
+{
+ // Falls Transparenz an war, diese zuruecknehmen
+ aOpenGL.Disable( GL_BLEND );
+ aOpenGL.DepthMask( TRUE );
+
+ // OutputDevice setzen und ZBuffer loeschen
+ aOpenGL.SetConnectOutputDevice(GetOutputDevice());
+ aOpenGL.Clear( GL_DEPTH_BUFFER_BIT );
+}
+
+/*************************************************************************
+|*
+|* Scissoring Region setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetScissorRegionPixel(const Rectangle& rRect, BOOL bActivate)
+{
+ // OpenGL specifics
+ aOpenGL.Scissor( rRect.Left(), rRect.Top(),
+ rRect.GetWidth(), rRect.GetHeight());
+
+ // call parent
+ Base3D::SetScissorRegionPixel(rRect, bActivate);
+}
+
+/*************************************************************************
+|*
+|* Dithering
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetDither(BOOL bNew)
+{
+ // call parent
+ Base3D::SetDither(bNew);
+
+ // OpenGL specifics
+ if(GetDither())
+ aOpenGL.Enable( GL_DITHER );
+ else
+ aOpenGL.Disable( GL_DITHER );
+}
+
+/*************************************************************************
+|*
+|* Scissoring aktivieren/deaktivieren
+|*
+\************************************************************************/
+
+void Base3DOpenGL::ActivateScissorRegion(BOOL bNew)
+{
+ // OpenGL specifics
+ if(bNew)
+ {
+ aOpenGL.Enable(GL_SCISSOR_TEST);
+ }
+ else
+ {
+ aOpenGL.Disable(GL_SCISSOR_TEST);
+ }
+
+ // call parent
+ Base3D::ActivateScissorRegion(bNew);
+}
+
+/*************************************************************************
+|*
+|* Ende der Szenenbeschreibung: Erzwinge bisher nicht erzeugte Ausgaben
+|*
+\************************************************************************/
+
+void Base3DOpenGL::EndScene()
+{
+ aOpenGL.Flush();
+ aOpenGL.Finish();
+}
+
+/*************************************************************************
+|*
+|* Neuen freien Eintrag fuer naechste geometrische Daten liefern
+|*
+\************************************************************************/
+
+B3dEntity& Base3DOpenGL::ImplGetFreeEntity()
+{
+ return aEntity;
+}
+
+/*************************************************************************
+|*
+|* starte primitiv auch in OpenGL
+|*
+\************************************************************************/
+
+void Base3DOpenGL::ImplStartPrimitive()
+{
+ bPhongBufferedMode = (GetShadeModel() == Base3DPhong
+ && GetRenderMode() == Base3DRenderFill
+ && (GetObjectMode() == Base3DTriangles
+ || GetObjectMode() == Base3DTriangleStrip
+ || GetObjectMode() == Base3DTriangleFan
+ || GetObjectMode() == Base3DQuads
+ || GetObjectMode() == Base3DQuadStrip
+ || GetObjectMode() == Base3DPolygon ));
+
+ // Transparenz beachten
+ if(GetMaterial(Base3DMaterialDiffuse).GetTransparency())
+ {
+ aOpenGL.Enable( GL_BLEND );
+ aOpenGL.DepthMask( FALSE );
+ aOpenGL.BlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ }
+ else
+ {
+ aOpenGL.Disable( GL_BLEND );
+ aOpenGL.DepthMask( TRUE );
+ }
+
+ if(bPhongBufferedMode)
+ {
+ // Phong-Modus: Ausgabe sammeln und in kleinere
+ // Dreiecke zerlegt bei ImplEndPrimitive() rendern
+ aPhongBuffer.Erase();
+ }
+ else
+ {
+ // OpenGL direkt benutzen
+ aOpenGL.Begin(GetObjectMode());
+ }
+}
+
+/*************************************************************************
+|*
+|* beende primitiv auch in OpenGL
+|*
+\************************************************************************/
+
+void Base3DOpenGL::ImplEndPrimitive()
+{
+ if(bPhongBufferedMode)
+ {
+ DrawPhongPrimitives();
+ }
+ else
+ {
+ aOpenGL.End();
+ }
+}
+
+/*************************************************************************
+|*
+|* Darstellungsqualitaet setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetDisplayQuality(UINT8 nNew)
+{
+ // call parent
+ Base3D::SetDisplayQuality(nNew);
+
+ // endgueltige Splittinggroesse neuberechnen
+ CalcInternPhongDivideSize();
+}
+
+/*************************************************************************
+|*
+|* PhongMode Splitting-Groesse neu setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetPhongDivideSize(long nNew)
+{
+ nPhongDivideSize = nNew;
+
+ // endgueltige Splittinggroesse neuberechnen
+ CalcInternPhongDivideSize();
+}
+
+/*************************************************************************
+|*
+|* PhongMode interne Splitting-Groesse neu setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::CalcInternPhongDivideSize()
+{
+ if(GetDisplayQuality() != 255)
+ {
+ long nNew = GetPhongDivideSize() +
+ ((255L - (INT32)GetDisplayQuality())>>2);
+ nInternPhongDivideSize = nNew * nNew;
+ }
+ else
+ nInternPhongDivideSize = GetPhongDivideSize() * GetPhongDivideSize();
+}
+
+/*************************************************************************
+|*
+|* Zeichne fuer Phong gebufferte primitive als Dreiecke
+|*
+\************************************************************************/
+
+void Base3DOpenGL::DrawPhongPrimitives()
+{
+ UINT32 aCount = aPhongBuffer.Count();
+ UINT32 aPos(0L);
+ bPhongBufferedMode = FALSE;
+ aOpenGL.Begin(Base3DTriangles);
+
+ switch(GetObjectMode())
+ {
+ case Base3DTriangles :
+ {
+ while(aPos < aCount)
+ {
+ DrawPhongTriangle(aPos, aPos+1, aPos+2);
+ aPos += 3;
+ }
+ break;
+ }
+ case Base3DTriangleStrip:
+ {
+ aPos = 1;
+ while(aPos < aCount)
+ {
+ if(aPos%2)
+ DrawPhongTriangle(aPos-1, aPos, aPos+1);
+ else
+ DrawPhongTriangle(aPos-1, aPos+1, aPos);
+ aPos++;
+ }
+ break;
+ }
+ case Base3DTriangleFan:
+ {
+ aPos = 1;
+ while(aPos < aCount)
+ {
+ DrawPhongTriangle(0, aPos, aPos+1);
+ aPos++;
+ }
+ break;
+ }
+ case Base3DQuads:
+ {
+ while(aPos < aCount)
+ {
+ DrawPhongTriangle(aPos, aPos+1, aPos+2);
+ DrawPhongTriangle(aPos+2, aPos+3, aPos);
+ aPos += 4;
+ }
+ break;
+ }
+ case Base3DQuadStrip:
+ {
+ aPos = 1;
+ while(aPos < aCount)
+ {
+ DrawPhongTriangle(aPos, aPos+1, aPos+3);
+ DrawPhongTriangle(aPos, aPos+3, aPos+2);
+ aPos+=2;
+ }
+ break;
+ }
+ case Base3DPolygon:
+ {
+ aPos = 2;
+ while(aPos < aCount)
+ {
+ DrawPhongTriangle(0, aPos-1, aPos);
+ aPos++;
+ }
+ break;
+ }
+ }
+ aOpenGL.End();
+}
+
+/*************************************************************************
+|*
+|* Zeichne fuer Phong gebufferte Dreiecke
+|*
+\************************************************************************/
+
+void Base3DOpenGL::DrawPhongTriangle(UINT32 nInd1, UINT32 nInd2, UINT32 nInd3)
+{
+ Vector3D aPos1 = GetTransformationSet()->ObjectToViewCoor(aPhongBuffer[nInd1].Point().GetVector3D());
+ double fXMin = aPos1.X();
+ double fXMax = aPos1.X();
+ double fYMin = aPos1.Y();
+ double fYMax = aPos1.Y();
+ Vector3D aPos2 = GetTransformationSet()->ObjectToViewCoor(aPhongBuffer[nInd2].Point().GetVector3D());
+ if(aPos2.X() < fXMin)
+ fXMin = aPos2.X();
+ if(aPos2.X() > fXMax)
+ fXMax = aPos2.X();
+ if(aPos2.Y() < fYMin)
+ fYMin = aPos2.Y();
+ if(aPos2.Y() > fYMax)
+ fYMax = aPos2.Y();
+ aPos2 = GetTransformationSet()->ObjectToViewCoor(aPhongBuffer[nInd3].Point().GetVector3D());
+ if(aPos2.X() < fXMin)
+ fXMin = aPos2.X();
+ if(aPos2.X() > fXMax)
+ fXMax = aPos2.X();
+ if(aPos2.Y() < fYMin)
+ fYMin = aPos2.Y();
+ if(aPos2.Y() > fYMax)
+ fYMax = aPos2.Y();
+
+ Size aPixelSize = GetOutputDevice()->LogicToPixel(
+ Size((long)(fXMax - fXMin),(long)(fYMax - fYMin)));
+ if(aPixelSize.Width() * aPixelSize.Height() > nInternPhongDivideSize)
+ {
+ UINT32 aCount = aPhongBuffer.Count();
+ aPhongBuffer.Append();
+ aPhongBuffer.Append();
+ aPhongBuffer.Append();
+
+ aPhongBuffer[aCount ].CalcMiddle(aPhongBuffer[nInd1], aPhongBuffer[nInd2]);
+ aPhongBuffer[aCount+1].CalcMiddle(aPhongBuffer[nInd2], aPhongBuffer[nInd3]);
+ aPhongBuffer[aCount+2].CalcMiddle(aPhongBuffer[nInd3], aPhongBuffer[nInd1]);
+
+ DrawPhongTriangle(nInd1, aCount, aCount+2);
+ DrawPhongTriangle(aCount, nInd2, aCount+1);
+ DrawPhongTriangle(aCount+1, nInd3, aCount+2);
+ DrawPhongTriangle(aCount, aCount+1, aCount+2);
+
+ aPhongBuffer.Remove();
+ aPhongBuffer.Remove();
+ aPhongBuffer.Remove();
+ }
+ else
+ {
+ ImplPostAddVertex(aPhongBuffer[nInd1]);
+ ImplPostAddVertex(aPhongBuffer[nInd2]);
+ ImplPostAddVertex(aPhongBuffer[nInd3]);
+ }
+}
+
+/*************************************************************************
+|*
+|* Geometrische Daten direkt an OpenGL weitergeben
+|* ACHTUNG! Es wird die aktuelle Farbe benutzt, NICHT die in Enttity3D
+|* enthaltene!
+|*
+\************************************************************************/
+
+void Base3DOpenGL::ImplPostAddVertex(B3dEntity& rEntity)
+{
+ if(bPhongBufferedMode)
+ {
+ aPhongBuffer.Append(rEntity);
+ }
+ else
+ {
+ // Normale setzen
+ if(rEntity.IsNormalUsed())
+ {
+ if(GetForceFlat() || GetShadeModel() == Base3DFlat)
+ {
+ if(rEntity.PlaneNormal() != aLastNormal)
+ {
+ aLastNormal = rEntity.PlaneNormal();
+ aOpenGL.Normal3dv(&aLastNormal.X());
+ }
+ }
+ else
+ {
+ if(rEntity.Normal() != aLastNormal)
+ {
+ aLastNormal = rEntity.Normal();
+ aOpenGL.Normal3dv(&aLastNormal.X());
+ }
+ }
+ }
+ else
+ {
+ if(aLastNormal != aEmptyVector)
+ {
+ aLastNormal = aEmptyVector;
+ aOpenGL.Normal3dv(&aLastNormal.X());
+ }
+ }
+
+ // Texturkoordinate setzen
+ if(rEntity.IsTexCoorUsed())
+ {
+ if(rEntity.TexCoor() != aLastTexCoor)
+ {
+ aLastTexCoor = rEntity.TexCoor();
+ aOpenGL.TexCoord3dv(&aLastTexCoor.X());
+ }
+ }
+ else
+ {
+ if(aLastTexCoor != aEmptyVector)
+ {
+ aLastTexCoor = aEmptyVector;
+ aOpenGL.TexCoord3dv(&aLastTexCoor.X());
+ }
+ }
+
+ // Punkt erzeugen
+ aOpenGL.Vertex3dv(&rEntity.Point().X());
+ }
+}
+
+/*************************************************************************
+|*
+|* beim setzen von color und alpha reagieren
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetColor(Color aNew)
+{
+ // call parent
+ Base3D::SetColor(aNew);
+
+ // Normale Farbausgabe
+ aOpenGL.Color4ub(GetColor().GetRed(), GetColor().GetGreen(),
+ GetColor().GetBlue(), 0xff - GetColor().GetTransparency());
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetMaterial(Color rNew, Base3DMaterialValue eVal,
+ Base3DMaterialMode eMode)
+{
+ // call parent
+ Base3D::SetMaterial(rNew, eVal, eMode);
+
+ // OpenGL Specifics
+ GLenum eFace = GL_FRONT_AND_BACK;
+ if(eMode == Base3DMaterialFront)
+ eFace = GL_FRONT;
+ if(eMode == Base3DMaterialBack)
+ eFace = GL_BACK;
+ GLenum eName = GL_SPECULAR;
+ if(eVal == Base3DMaterialAmbient)
+ eName = GL_AMBIENT;
+ if(eVal == Base3DMaterialDiffuse)
+ eName = GL_DIFFUSE;
+ if(eVal == Base3DMaterialEmission)
+ eName = GL_EMISSION;
+
+ // Array fuellen
+ float fArray[4] = {
+ ((float)GetMaterial(eVal, eMode).GetRed()) / (float)255.0,
+ ((float)GetMaterial(eVal, eMode).GetGreen()) / (float)255.0,
+ ((float)GetMaterial(eVal, eMode).GetBlue()) / (float)255.0,
+ ((float)(255 - GetMaterial(eVal, eMode).GetTransparency())) / (float)255.0
+ };
+
+ aOpenGL.Materialfv(eFace, eName, fArray);
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften setzen, exponent der specular-Eigenschaft
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetShininess(UINT16 nExponent,
+ Base3DMaterialMode eMode)
+{
+ // call parent
+ Base3D::SetShininess(nExponent, eMode);
+
+ // OpenGL Specifics
+ GLenum eFace = GL_FRONT_AND_BACK;
+ if(eMode == Base3DMaterialFront)
+ eFace = GL_FRONT;
+ if(eMode == Base3DMaterialBack)
+ eFace = GL_BACK;
+ aOpenGL.Materialf(eFace, GL_SHININESS, (float)nExponent);
+}
+
+/*************************************************************************
+|*
+|* Aktuell zu benutzende Textur setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetActiveTexture(B3dTexture* pTex)
+{
+ // call parent
+ Base3D::SetActiveTexture(pTex);
+
+ // make current texture, cast ist unkritisch, da innerhalb von
+ // Base3DOpenGL nur Texturen von diesem Typ angelegt worden
+ // sein koennen
+ if(GetActiveTexture())
+ {
+ aOpenGL.Enable(GL_TEXTURE_2D);
+ ((B3dTextureOpenGL*)GetActiveTexture())->MakeCurrentTexture(aOpenGL);
+ }
+ else
+ {
+ aOpenGL.BindTexture(GL_TEXTURE_2D, 0);
+ aOpenGL.Disable(GL_TEXTURE_2D);
+ }
+}
+
+/*************************************************************************
+|*
+|* Ein Textur-Objekt inkarnieren
+|*
+\************************************************************************/
+
+B3dTexture* Base3DOpenGL::CreateTexture(TextureAttributes& rAtt, Bitmap& rBitmap)
+{
+ // Hier Parent NICHT rufen! Sonst wird auch noch eine normale Textur erzeugt
+ B3dTextureOpenGL* pRetval = new B3dTextureOpenGL(rAtt, rBitmap, aOpenGL);
+ DBG_ASSERT(pRetval,"AW: Kein Speicher fuer OpenGL-Textur bekommen!");
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* OpenGL - Textur loeschen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::DestroyTexture(B3dTexture* pTex)
+{
+ // Spezielle Loeschaufgaben im Zusammenhang mit OpenGL
+ ((B3dTextureOpenGL*)pTex)->DestroyOpenGLTexture(aOpenGL);
+
+ // call parent, endgueltig loeschen
+ Base3D::DestroyTexture(pTex);
+}
+
+/*************************************************************************
+|*
+|* PolygonOffset setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetPolygonOffset(Base3DPolygonOffset eNew, BOOL bNew)
+{
+ // call parent
+ Base3D::SetPolygonOffset(eNew, bNew);
+
+ if(GetPolygonOffset())
+ aOpenGL.PolygonOffset((float)(fOffFacMul100 / 100.0), (float)(fOffUniMul100 / 100.0));
+ else
+ aOpenGL.PolygonOffset((float)0.0, (float)0.0);
+
+ // OpenGL Specifics
+ switch(eNew)
+ {
+ case Base3DPolygonOffsetFill :
+ if(bNew)
+ aOpenGL.Enable( GL_POLYGON_OFFSET_FILL );
+ else
+ aOpenGL.Disable( GL_POLYGON_OFFSET_FILL );
+ break;
+
+ case Base3DPolygonOffsetLine :
+ if(bNew)
+ aOpenGL.Enable( GL_POLYGON_OFFSET_LINE );
+ else
+ aOpenGL.Disable( GL_POLYGON_OFFSET_LINE );
+ break;
+
+ case Base3DPolygonOffsetPoint :
+ if(bNew)
+ aOpenGL.Enable( GL_POLYGON_OFFSET_POINT );
+ else
+ aOpenGL.Disable( GL_POLYGON_OFFSET_POINT );
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Beleuchtung setzen/lesen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetLightGroup(B3dLightGroup* pSet, BOOL bSetGlobal)
+{
+ // call parent
+ Base3D::SetLightGroup(pSet, bSetGlobal);
+
+ if(GetLightGroup())
+ {
+ // Allgemeine Parameter setzen
+ SetGlobalAmbientLight(GetLightGroup()->GetGlobalAmbientLight());
+ SetLocalViewer(GetLightGroup()->GetLocalViewer());
+ SetModelTwoSide(GetLightGroup()->GetModelTwoSide());
+ EnableLighting(GetLightGroup()->IsLightingEnabled());
+
+ // Einzelne Lampen setzen
+ if(GetTransformationSet() && bSetGlobal)
+ {
+ aOpenGL.MatrixMode(GL_MODELVIEW);
+ aOpenGL.LoadIdentity();
+ }
+
+ // Set and enable lights from the beginning of array in
+ // OpenGL
+ UINT16 nNumAlloc = 0;
+
+ UINT16 a;
+ for(a=0;aGetLightObject(eNum);
+
+ if(rLight.IsEnabled())
+ {
+ Base3DLightNumber eNumAlloc = (Base3DLightNumber)(Base3DLight0 + nNumAlloc);
+ nNumAlloc++;
+
+ Enable(TRUE, eNumAlloc);
+
+ SetIntensity(rLight.GetIntensity(Base3DMaterialAmbient),
+ Base3DMaterialAmbient, eNumAlloc);
+ SetIntensity(rLight.GetIntensity(Base3DMaterialDiffuse),
+ Base3DMaterialDiffuse, eNumAlloc);
+ SetIntensity(rLight.GetIntensity(Base3DMaterialSpecular),
+ Base3DMaterialSpecular, eNumAlloc);
+
+ if(rLight.IsDirectionalSource())
+ {
+ SetDirection(rLight.GetPosition(), eNumAlloc);
+ }
+ else
+ {
+ SetPosition(rLight.GetPosition(), eNumAlloc);
+ SetSpotDirection(rLight.GetSpotDirection(), eNumAlloc);
+ SetSpotExponent(rLight.GetSpotExponent(), eNumAlloc);
+ SetSpotCutoff(rLight.GetSpotCutoff(), eNumAlloc);
+ }
+
+ SetConstantAttenuation(rLight.GetConstantAttenuation(), eNumAlloc);
+ SetLinearAttenuation(rLight.GetLinearAttenuation(), eNumAlloc);
+ SetQuadraticAttenuation(rLight.GetQuadraticAttenuation(), eNumAlloc);
+ }
+ }
+
+ for(a=nNumAlloc;aGetDrawMode() & DRAWMODE_GRAYFILL)
+ {
+ // Graustufen
+ UINT8 nLuminance = rNew.GetLuminance();
+ aSource.SetRed(nLuminance);
+ aSource.SetGreen(nLuminance);
+ aSource.SetBlue(nLuminance);
+ aSource.SetTransparency(rNew.GetTransparency());
+ }
+ else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
+ {
+ // Keine Ausgabe, hier Weiss als Farbe setzen
+ aSource = Color(COL_WHITE);
+ }
+ else
+ {
+ // Normale Farbausgabe
+ aSource = rNew;
+ }
+
+ // Array fuellen
+ float fArray[4] = {
+ ((float)aSource.GetRed()) / (float)255.0,
+ ((float)aSource.GetGreen()) / (float)255.0,
+ ((float)aSource.GetBlue()) / (float)255.0,
+ ((float)aSource.GetTransparency()) / (float)255.0
+ };
+ aOpenGL.LightModelfv(GL_LIGHT_MODEL_AMBIENT, fArray);
+}
+
+/*************************************************************************
+|*
+|* Modus globaler Viewer bei Berechnung specular reflection setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetLocalViewer(BOOL bNew)
+{
+ // OpenGL Specifics
+ aOpenGL.LightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER,
+ bNew ? (float)0.0 : (float)1.0);
+}
+
+/*************************************************************************
+|*
+|* Modus Beleuchtungsmodell beidseitig anwenden setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetModelTwoSide(BOOL bNew)
+{
+ // OpenGL Specifics
+ aOpenGL.LightModelf(GL_LIGHT_MODEL_TWO_SIDE,
+ bNew ? (float)1.0 : (float)0.0);
+}
+
+/*************************************************************************
+|*
+|* Beleuchtungsmodell aktivieren/deaktivieren
+|*
+\************************************************************************/
+
+void Base3DOpenGL::EnableLighting(BOOL bNew)
+{
+ // OpenGL Specifics
+ if(bNew)
+ aOpenGL.Enable( GL_LIGHTING );
+ else
+ aOpenGL.Disable( GL_LIGHTING );
+}
+
+/*************************************************************************
+|*
+|* Die Intensitaet eines bestimmten Aspekts einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetIntensity(const Color rNew,
+ Base3DMaterialValue eVal, Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ Color aSource;
+ if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
+ {
+ // Graustufen
+ UINT8 nLuminance = rNew.GetLuminance();
+ aSource.SetRed(nLuminance);
+ aSource.SetGreen(nLuminance);
+ aSource.SetBlue(nLuminance);
+ aSource.SetTransparency(rNew.GetTransparency());
+ }
+ else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
+ {
+ // Keine Ausgabe, hier Weiss als Farbe setzen
+ aSource = Color(COL_WHITE);
+ }
+ else
+ {
+ // Normale Farbausgabe
+ aSource = rNew;
+ }
+
+ // Array fuellen
+ float fArray[4] = {
+ ((float)aSource.GetRed()) / (float)255.0,
+ ((float)aSource.GetGreen()) / (float)255.0,
+ ((float)aSource.GetBlue()) / (float)255.0,
+ ((float)aSource.GetTransparency()) / (float)255.0
+ };
+
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ GLenum eName = GL_SPECULAR;
+ if(eVal == Base3DMaterialAmbient)
+ eName = GL_AMBIENT;
+ if(eVal == Base3DMaterialDiffuse)
+ eName = GL_DIFFUSE;
+ aOpenGL.Lightfv(eLight, eName, fArray);
+}
+
+/*************************************************************************
+|*
+|* Die Position einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetPosition(const Vector3D& rNew, Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ float fArray[4] = {
+ (float)rNew[0], (float)rNew[1], (float)rNew[2], (float)1.0
+ };
+ aOpenGL.Lightfv(eLight, GL_POSITION, fArray);
+}
+
+/*************************************************************************
+|*
+|* Die Richtung einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetDirection(const Vector3D& rNew, Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ float fArray[4] = {
+ (float)rNew[0], (float)rNew[1], (float)rNew[2], (float)0.0
+ };
+ aOpenGL.Lightfv(eLight, GL_POSITION, fArray);
+}
+
+/*************************************************************************
+|*
+|* Die Richtung einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetSpotDirection(const Vector3D& rNew,
+ Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ float fArray[4] = {
+ (float)rNew[0], (float)rNew[1], (float)rNew[2], (float)0.0
+ };
+ aOpenGL.Lightfv(eLight, GL_SPOT_DIRECTION, fArray);
+}
+
+/*************************************************************************
+|*
+|* Den SpotExponent einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetSpotExponent(UINT16 nNew, Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ aOpenGL.Lightf(eLight, GL_SPOT_EXPONENT, (float)nNew);
+}
+
+/*************************************************************************
+|*
+|* Die Einengung des Lichtkegels einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetSpotCutoff(double fNew, Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ aOpenGL.Lightf(eLight, GL_SPOT_CUTOFF, (float)fNew);
+}
+
+/*************************************************************************
+|*
+|* Den konstanten AttenuationFactor einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetConstantAttenuation(double fNew,
+ Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ aOpenGL.Lightf(eLight, GL_CONSTANT_ATTENUATION, (float)fNew);
+}
+
+/*************************************************************************
+|*
+|* Den linearen AttenuationFactor einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetLinearAttenuation(double fNew,
+ Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ aOpenGL.Lightf(eLight, GL_LINEAR_ATTENUATION, (float)fNew);
+}
+
+/*************************************************************************
+|*
+|* Den quadratischen AttenuationFactor einer Lichtquelle setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetQuadraticAttenuation(double fNew,
+ Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ aOpenGL.Lightf(eLight, GL_QUADRATIC_ATTENUATION, (float)fNew);
+}
+
+/*************************************************************************
+|*
+|* Eine Lichtquelle aktivieren/deaktivieren
+|*
+\************************************************************************/
+
+void Base3DOpenGL::Enable(BOOL bNew, Base3DLightNumber eNum)
+{
+ // OpenGL Specifics
+ GLenum eLight = GL_LIGHT0 + (eNum - Base3DLight0);
+ if(bNew)
+ aOpenGL.Enable(eLight);
+ else
+ aOpenGL.Disable(eLight);
+}
+
+/*************************************************************************
+|*
+|* RenderMode setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetRenderMode(Base3DRenderMode eNew,
+ Base3DMaterialMode eMode)
+{
+ // call parent
+ Base3D::SetRenderMode(eNew, eMode);
+
+ // OpenGL Specifics
+ GLenum eFace = GL_FRONT_AND_BACK;
+ if(eMode == Base3DMaterialFront)
+ eFace = GL_FRONT;
+ if(eMode == Base3DMaterialBack)
+ eFace = GL_BACK;
+
+ switch(eNew)
+ {
+ case Base3DRenderNone :
+ {
+ break;
+ }
+ case Base3DRenderPoint :
+ {
+ aOpenGL.PolygonMode(eFace, GL_POINT);
+ break;
+ }
+ case Base3DRenderLine :
+ {
+ aOpenGL.PolygonMode(eFace, GL_LINE);
+ break;
+ }
+ case Base3DRenderFill :
+ {
+ aOpenGL.PolygonMode(eFace, GL_FILL);
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* ShadeModel setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetShadeModel(Base3DShadeModel eNew)
+{
+ // call parent
+ Base3D::SetShadeModel(eNew);
+
+ switch(eNew)
+ {
+ case Base3DSmooth :
+ case Base3DPhong :
+ {
+ aOpenGL.ShadeModel(GL_SMOOTH);
+ break;
+ }
+ case Base3DFlat :
+ {
+ aOpenGL.ShadeModel(GL_FLAT);
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* CullingMode setzen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetCullMode(Base3DCullMode eNew)
+{
+ // call parent
+ Base3D::SetCullMode(eNew);
+
+ switch(eNew)
+ {
+ case Base3DCullFront :
+ {
+ aOpenGL.CullFace(GL_FRONT);
+ aOpenGL.Enable(GL_CULL_FACE);
+ break;
+ }
+ case Base3DCullBack :
+ {
+ aOpenGL.CullFace(GL_BACK);
+ aOpenGL.Enable(GL_CULL_FACE);
+ break;
+ }
+ case Base3DCullNone :
+ {
+ aOpenGL.Disable(GL_CULL_FACE);
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* EdgeFlag schreiben
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetEdgeFlag(BOOL bNew)
+{
+ // EdgeFlag fuer OpenGL setzen
+ if(bNew)
+ aOpenGL.EdgeFlag(GL_TRUE);
+ else
+ aOpenGL.EdgeFlag(GL_FALSE);
+
+ // call parent
+ Base3D::SetEdgeFlag(bNew);
+}
+
+/*************************************************************************
+|*
+|* PointSize schreiben
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetPointSize(double fNew)
+{
+ // PointSize fuer OpenGL setzen
+ aOpenGL.PointSize((GLfloat)fNew);
+
+ // call parent
+ Base3D::SetPointSize(fNew);
+}
+
+/*************************************************************************
+|*
+|* LineWidth schreiben
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetLineWidth(double fNew)
+{
+ // LineWidth fuer OpenGL setzen
+ aOpenGL.LineWidth((GLfloat)fNew);
+
+ // call parent
+ Base3D::SetLineWidth(fNew);
+}
+
+/*************************************************************************
+|*
+|* Callbacks bei Matrixaenderungen, Default-Implementierungen
+|*
+\************************************************************************/
+
+void Base3DOpenGL::SetTransformationSet(B3dTransformationSet* pSet)
+{
+ // call parent
+ Base3D::SetTransformationSet(pSet);
+
+ if(GetTransformationSet())
+ {
+ PostSetObjectOrientation(GetTransformationSet());
+ PostSetProjection(GetTransformationSet());
+ PostSetTexture(GetTransformationSet());
+ PostSetViewport(GetTransformationSet());
+ }
+}
+
+void Base3DOpenGL::PostSetObjectOrientation(B3dTransformationSet* pCaller)
+{
+ // OpenGL specifics
+ Matrix4D aMat = pCaller->GetObjectTrans();
+ aMat *= pCaller->GetOrientation();
+ double fBuffer[16] = {
+ aMat[0][0], aMat[1][0], aMat[2][0], aMat[3][0],
+ aMat[0][1], aMat[1][1], aMat[2][1], aMat[3][1],
+ aMat[0][2], aMat[1][2], aMat[2][2], aMat[3][2],
+ aMat[0][3], aMat[1][3], aMat[2][3], aMat[3][3]
+ };
+ aOpenGL.MatrixMode(GL_MODELVIEW);
+ aOpenGL.LoadMatrixd(fBuffer);
+}
+
+void Base3DOpenGL::PostSetProjection(B3dTransformationSet* pCaller)
+{
+ // OpenGL specifics
+ const Matrix4D& rMat = pCaller->GetProjection();
+ double fBuffer[16] = {
+ rMat[0][0], rMat[1][0], rMat[2][0], rMat[3][0],
+ rMat[0][1], rMat[1][1], rMat[2][1], rMat[3][1],
+ rMat[0][2], rMat[1][2], rMat[2][2], rMat[3][2],
+ rMat[0][3], rMat[1][3], rMat[2][3], rMat[3][3]
+ };
+ aOpenGL.MatrixMode(GL_PROJECTION);
+ aOpenGL.LoadMatrixd(fBuffer);
+}
+
+void Base3DOpenGL::PostSetTexture(B3dTransformationSet* pCaller)
+{
+ // OpenGL specifics
+ const Matrix4D& rMat = pCaller->GetTexture();
+ double fBuffer[16] = {
+ rMat[0][0], rMat[1][0], rMat[2][0], rMat[3][0],
+ rMat[0][1], rMat[1][1], rMat[2][1], rMat[3][1],
+ rMat[0][2], rMat[1][2], rMat[2][2], rMat[3][2],
+ rMat[0][3], rMat[1][3], rMat[2][3], rMat[3][3]
+ };
+ aOpenGL.MatrixMode(GL_TEXTURE);
+ aOpenGL.LoadMatrixd(fBuffer);
+}
+
+void Base3DOpenGL::PostSetViewport(B3dTransformationSet* pCaller)
+{
+ // OpenGL specifics
+ Rectangle aBoundPixel(GetOutputDevice()->
+ LogicToPixel(pCaller->GetLogicalViewportBounds()));
+ aOpenGL.Viewport( aBoundPixel.Left(), aBoundPixel.Top(),
+ aBoundPixel.GetWidth() - 1, aBoundPixel.GetHeight() - 1);
+}
+
+/*************************************************************************
+|*
+|* Ein Objekt in Form einer B3dGeometry direkt ausgeben
+|*
+\************************************************************************/
+
+void Base3DOpenGL::DrawPolygonGeometry(B3dGeometry& rGeometry, BOOL bOutline)
+{
+ // bForceToSinglePrimitiveOutput: (#70626#)
+ if(bForceToSinglePrimitiveOutput || (GetShadeModel() == Base3DPhong && GetRenderMode() == Base3DRenderFill))
+ {
+ // call parent, render with many primitives
+ Base3D::DrawPolygonGeometry(rGeometry, bOutline);
+ }
+ else
+ {
+ // Buckets der Geometrie holen
+ B3dEntityBucket& rEntityBucket = rGeometry.GetEntityBucket();
+ GeometryIndexValueBucket& rIndexBucket = rGeometry.GetIndexBucket();
+
+ if(rEntityBucket.Count() && rIndexBucket.Count())
+ {
+ // Arrays aktivieren
+ aOpenGL.EnableClientState(GL_VERTEX_ARRAY);
+
+ UINT32 nPolyCounter = 0;
+ UINT32 nEntityCounter = 0;
+ UINT32 nArrayStartIndex = 0;
+ UINT32 nUpperBound;
+
+ // Pointer setzen
+ UINT16 nArray = 0;
+ aOpenGL.VertexPointer(3, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].Point());
+
+ if(bOutline)
+ {
+ // Transparenz Linien beachten
+ if(GetColor().GetTransparency())
+ {
+ aOpenGL.Enable( GL_BLEND );
+ aOpenGL.DepthMask( FALSE );
+ aOpenGL.BlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ }
+ else
+ {
+ aOpenGL.Disable( GL_BLEND );
+ aOpenGL.DepthMask( TRUE );
+ }
+
+ // ALLE Linien Zeichnen
+ aOpenGL.Disable(GL_CULL_FACE);
+
+ // Polygone als Outline ausgeben
+ aOpenGL.PolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ aOpenGL.PolygonOffset((float)(fOffFacMul100 / 100.0), (float)(fOffUniMul100 / 100.0));
+ aOpenGL.Enable( GL_POLYGON_OFFSET_LINE );
+ aOpenGL.EnableClientState(GL_EDGE_FLAG_ARRAY);
+ aOpenGL.EdgeFlagPointer(rEntityBucket.GetSlotSize(), &rEntityBucket[0].EdgeFlag());
+
+ while(nPolyCounter < rIndexBucket.Count())
+ {
+ // Naechstes Primitiv
+ nUpperBound = rIndexBucket[nPolyCounter].GetIndex();
+ BOOL bLineMode = (rIndexBucket[nPolyCounter++].GetMode() == B3D_INDEX_MODE_LINE);
+
+ if(nUpperBound >> rEntityBucket.GetBlockShift() != nArray)
+ {
+ // Einzelschritt, Bereichsueberschreitung im Buffer
+ // Als Polygon ausgeben
+ aOpenGL.Begin(bLineMode ? Base3DLineStrip : Base3DPolygon);
+
+ // Polygon ausgeben
+ while(nEntityCounter < nUpperBound)
+ {
+ B3dEntity& rEntity = rEntityBucket[nEntityCounter++];
+ aOpenGL.EdgeFlag(rEntity.IsEdgeVisible() ? GL_TRUE : GL_FALSE);
+ aOpenGL.Vertex3dv((const double *)(&rEntity.Point()));
+ }
+
+ // Primitiv abschliessen
+ aOpenGL.End();
+
+ // NUR auf neues Array setzen, wenn noch was da ist (#59941#)
+ if(nEntityCounter < rEntityBucket.Count())
+ {
+ // Pointer auf neues Array setzen
+ nArray = (UINT16)(nEntityCounter >> rEntityBucket.GetBlockShift());
+ nArrayStartIndex = nEntityCounter;
+ B3dEntity& rStart = rEntityBucket[nEntityCounter];
+
+ aOpenGL.VertexPointer(3, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rStart);
+ aOpenGL.EdgeFlagPointer(rEntityBucket.GetSlotSize(), &(rStart.EdgeFlag()));
+ }
+ }
+ else
+ {
+ // Primitiv komplett raushauen, liegt in einem Buffer
+ aOpenGL.DrawArrays(bLineMode ? Base3DLineStrip : Base3DPolygon,
+ nEntityCounter - nArrayStartIndex,
+ nUpperBound - nEntityCounter);
+ nEntityCounter = nUpperBound;
+ }
+ }
+
+ // Arrays deaktivieren
+ aOpenGL.DisableClientState(GL_VERTEX_ARRAY);
+ aOpenGL.DisableClientState(GL_EDGE_FLAG_ARRAY);
+ }
+ else
+ {
+ // Transparenz Flaechen beachten
+ if(GetMaterial(Base3DMaterialDiffuse).GetTransparency())
+ {
+ aOpenGL.Enable( GL_BLEND );
+ aOpenGL.DepthMask( FALSE );
+ aOpenGL.BlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ }
+ else
+ {
+ aOpenGL.Disable( GL_BLEND );
+ aOpenGL.DepthMask( TRUE );
+ }
+
+ // Polygone gefuellt ausgeben
+ aOpenGL.PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ aOpenGL.EnableClientState(GL_NORMAL_ARRAY);
+ aOpenGL.EnableClientState(GL_TEXTURE_COORD_ARRAY);
+ if(GetForceFlat() || GetShadeModel() == Base3DFlat)
+ aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].PlaneNormal());
+ else
+ aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].Normal());
+ aOpenGL.TexCoordPointer(2, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rEntityBucket[0].TexCoor());
+
+ while(nPolyCounter < rIndexBucket.Count())
+ {
+ // Naechstes Primitiv
+ nUpperBound = rIndexBucket[nPolyCounter].GetIndex();
+ BOOL bLineMode = (rIndexBucket[nPolyCounter++].GetMode() == B3D_INDEX_MODE_LINE);
+
+ if(nUpperBound >> rEntityBucket.GetBlockShift() != nArray)
+ {
+ // Einzelschritt, Bereichsueberschreitung im Buffer
+ // Als Polygon ausgeben
+ aOpenGL.Begin(bLineMode ? Base3DLineStrip : Base3DPolygon);
+
+ // Polygon ausgeben
+ while(nEntityCounter < nUpperBound)
+ {
+ B3dEntity& rEntity = rEntityBucket[nEntityCounter++];
+ if(GetForceFlat() || GetShadeModel() == Base3DFlat)
+ aOpenGL.Normal3dv((const double *)(&rEntity.PlaneNormal()));
+ else
+ aOpenGL.Normal3dv((const double *)(&rEntity.Normal()));
+ aOpenGL.TexCoord3dv((const double *)(&rEntity.TexCoor()));
+ aOpenGL.Vertex3dv((const double *)(&rEntity.Point()));
+ }
+
+ // Primitiv abschliessen
+ aOpenGL.End();
+
+ // NUR auf neues Array setzen, wenn noch was da ist (#58702#)
+ if(nEntityCounter < rEntityBucket.Count())
+ {
+ // Pointer auf neues Array setzen
+ nArray = (UINT16)(nEntityCounter >> rEntityBucket.GetBlockShift());
+ nArrayStartIndex = nEntityCounter;
+ B3dEntity& rStart = rEntityBucket[nEntityCounter];
+
+ aOpenGL.VertexPointer(3, GL_DOUBLE, rEntityBucket.GetSlotSize(), &rStart);
+ if(GetForceFlat() || GetShadeModel() == Base3DFlat)
+ aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &(rStart.PlaneNormal()));
+ else
+ aOpenGL.NormalPointer(GL_DOUBLE, rEntityBucket.GetSlotSize(), &(rStart.Normal()));
+ aOpenGL.TexCoordPointer(2, GL_DOUBLE, rEntityBucket.GetSlotSize(), &(rStart.TexCoor()));
+ }
+ }
+ else
+ {
+ // Primitiv komplett raushauen, liegt in einem Buffer
+ aOpenGL.DrawArrays(bLineMode ? Base3DLineStrip : Base3DPolygon,
+ nEntityCounter - nArrayStartIndex,
+ nUpperBound - nEntityCounter);
+ nEntityCounter = nUpperBound;
+ }
+ }
+
+ // Arrays deaktivieren
+ aOpenGL.DisableClientState(GL_VERTEX_ARRAY);
+ aOpenGL.DisableClientState(GL_NORMAL_ARRAY);
+ aOpenGL.DisableClientState(GL_TEXTURE_COORD_ARRAY);
+ }
+ }
+ }
+}
+
diff --git a/goodies/source/base3d/b3dopngl.hxx b/goodies/source/base3d/b3dopngl.hxx
new file mode 100644
index 000000000000..910cb49caa0a
--- /dev/null
+++ b/goodies/source/base3d/b3dopngl.hxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dopngl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DOPNGL_HXX
+#define _B3D_B3DOPNGL_HXX
+
+#ifndef _B3D_BASE3D_HXX
+#include "base3d.hxx"
+#endif
+
+#ifndef _SV_OPENGL_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Die Basisklasse fuer Standard 3D Ausgaben mittels OpenGL unter
+|* Windows (Win95 und Windows NT)
+|*
+\************************************************************************/
+
+class Base3DOpenGL : public Base3D
+{
+private:
+ // Datenuebergabe
+ B3dEntity aEntity;
+
+ // OpenGL Objekt
+ OpenGL aOpenGL;
+
+ // Letzte Normale und letzte Texturkoordinate
+ Vector3D aLastNormal;
+ Vector3D aLastTexCoor;
+ Vector3D aEmptyVector;
+
+ float fOffFacMul100;
+ float fOffUniMul100;
+
+ // Simulation Phong-Mode
+ BOOL bPhongBufferedMode;
+ B3dEntityBucket aPhongBuffer;
+ long nPhongDivideSize;
+ long nInternPhongDivideSize;
+
+ // flags (#70626#)
+ BOOL bForceToSinglePrimitiveOutput;
+
+ void DrawPhongPrimitives();
+ void DrawPhongTriangle(UINT32 nInd1, UINT32 nInd2, UINT32 nInd3);
+ void CalcInternPhongDivideSize();
+
+public:
+ Base3DOpenGL(OutputDevice* pOutDev);
+
+ // DivideSize bei Phong-Simulation
+ long GetPhongDivideSize() { return nPhongDivideSize; }
+ void SetPhongDivideSize(long nNew);
+
+ // Get/Set force to single primitive output (#70626#)
+ BOOL IsForceToSinglePrimitiveOutput() const { return bForceToSinglePrimitiveOutput; }
+ void SetForceToSinglePrimitiveOutput(BOOL bNew) { bForceToSinglePrimitiveOutput = bNew; }
+
+ // Typbestimmung
+ virtual UINT16 GetBase3DType();
+
+ virtual void StartScene();
+ virtual void EndScene();
+
+ // Scissoring
+ virtual void SetScissorRegionPixel(const Rectangle& rRect, BOOL bActivate=TRUE);
+ virtual void ActivateScissorRegion(BOOL bNew);
+
+ // Dithering
+ virtual void SetDither(BOOL bNew);
+
+ // Farbe
+ virtual void SetColor(Color aNew);
+
+ // Material
+ virtual void SetMaterial(Color rNew,
+ Base3DMaterialValue=Base3DMaterialAmbient,
+ Base3DMaterialMode=Base3DMaterialFrontAndBack);
+ virtual void SetShininess(UINT16 nExponent,
+ Base3DMaterialMode=Base3DMaterialFrontAndBack);
+
+ // Texturen
+private:
+ virtual B3dTexture* CreateTexture(TextureAttributes& rAtt, Bitmap& rBitmap);
+ virtual void DestroyTexture(B3dTexture*);
+public:
+ virtual void SetActiveTexture(B3dTexture* pTex=NULL);
+
+ // Darstellungsqualitaet
+ virtual void SetDisplayQuality(UINT8 nNew);
+
+ // PolygonOffset
+ virtual void SetPolygonOffset(
+ Base3DPolygonOffset eNew=Base3DPolygonOffsetLine, BOOL bNew=FALSE);
+
+ // Beleuchtung setzen/lesen
+ virtual void SetLightGroup(B3dLightGroup* pSet, BOOL bSetGlobal=TRUE);
+
+ virtual void SetRenderMode(Base3DRenderMode eNew,
+ Base3DMaterialMode=Base3DMaterialFrontAndBack);
+ virtual void SetShadeModel(Base3DShadeModel eNew);
+ virtual void SetCullMode(Base3DCullMode eNew);
+
+ virtual void SetEdgeFlag(BOOL bNew=TRUE);
+ virtual void SetPointSize(double fNew=1.0);
+ virtual void SetLineWidth(double fNew=1.0);
+
+ // Ein Objekt in Form einer B3dGeometry direkt ausgeben
+ virtual void DrawPolygonGeometry(B3dGeometry& rGeometry, BOOL bOutline=FALSE);
+
+ // Callbacks bei Matrixaenderungen
+ virtual void SetTransformationSet(B3dTransformationSet* pSet);
+
+protected:
+ // Geometrische Daten uebergeben
+ virtual B3dEntity& ImplGetFreeEntity();
+ virtual void ImplPostAddVertex(B3dEntity& rEnt);
+
+ virtual void ImplStartPrimitive();
+ virtual void ImplEndPrimitive();
+
+ // Callbacks bei Matrixaenderungen
+ void PostSetObjectOrientation(B3dTransformationSet* pCaller);
+ void PostSetProjection(B3dTransformationSet* pCaller);
+ void PostSetTexture(B3dTransformationSet* pCaller);
+ void PostSetViewport(B3dTransformationSet* pCaller);
+
+ // lokale Parameter des LightModels
+ void SetGlobalAmbientLight(const Color rNew);
+ void SetLocalViewer(BOOL bNew=TRUE);
+ void SetModelTwoSide(BOOL bNew=FALSE);
+
+ // Hauptschalter fuer die Beleuchtung
+ void EnableLighting(BOOL bNew=TRUE);
+
+ // Lichtquellen Interface
+ void SetIntensity(const Color rNew,
+ Base3DMaterialValue=Base3DMaterialAmbient,
+ Base3DLightNumber=Base3DLight0);
+ void SetPosition(const Vector3D& rNew,
+ Base3DLightNumber=Base3DLight0);
+ void SetDirection(const Vector3D& rNew,
+ Base3DLightNumber=Base3DLight0);
+ void SetSpotDirection(const Vector3D& rNew,
+ Base3DLightNumber=Base3DLight0);
+ void SetSpotExponent(UINT16 nNew,
+ Base3DLightNumber=Base3DLight0);
+ void SetSpotCutoff(double fNew,
+ Base3DLightNumber=Base3DLight0);
+ void SetConstantAttenuation(double fNew,
+ Base3DLightNumber=Base3DLight0);
+ void SetLinearAttenuation(double fNew,
+ Base3DLightNumber=Base3DLight0);
+ void SetQuadraticAttenuation(double fNew,
+ Base3DLightNumber=Base3DLight0);
+ void Enable(BOOL bNew=TRUE,
+ Base3DLightNumber=Base3DLight0);
+};
+
+
+#endif // _B3D_B3DOPNGL_HXX
diff --git a/goodies/source/base3d/b3dtex.cxx b/goodies/source/base3d/b3dtex.cxx
new file mode 100644
index 000000000000..39c67644b30f
--- /dev/null
+++ b/goodies/source/base3d/b3dtex.cxx
@@ -0,0 +1,1176 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dtex.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DTEX_HXX
+#include "b3dtex.hxx"
+#endif
+
+#ifndef _B3D_B3DOPNGL_HXX
+#include "b3dopngl.hxx"
+#endif
+
+#ifndef _SV_BMPACC_HXX
+#include
+#endif
+
+#ifndef _NEW_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Klassen fuer TexturAttribute beim Anfordern von Texturen
+|*
+\************************************************************************/
+
+TextureAttributes::TextureAttributes()
+{
+}
+
+// Fuer Bitmaps
+
+TextureAttributesBitmap::TextureAttributesBitmap(Bitmap aBmp)
+: TextureAttributes(),
+ aBitmapAttribute(aBmp)
+{
+}
+
+BOOL TextureAttributesBitmap::operator==(const TextureAttributes& rAtt) const
+{
+ if(GetTextureAttributeType() == rAtt.GetTextureAttributeType())
+ {
+ const TextureAttributesBitmap& rAttBmp = (const TextureAttributesBitmap&)rAtt;
+
+ if(rAttBmp.aBitmapAttribute == aBitmapAttribute)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+UINT16 TextureAttributesBitmap::GetTextureAttributeType() const
+{
+ return TEXTURE_ATTRIBUTE_TYPE_BITMAP;
+}
+
+// Fuer Gradientfills
+
+TextureAttributesGradient::TextureAttributesGradient(void* pF, void *pSC)
+: TextureAttributes(),
+ pFill(pF),
+ pStepCount(pSC)
+{
+}
+
+BOOL TextureAttributesGradient::operator==(const TextureAttributes& rAtt) const
+{
+ if(GetTextureAttributeType() == rAtt.GetTextureAttributeType())
+ {
+ const TextureAttributesGradient& rAttGra = (const TextureAttributesGradient&)rAtt;
+
+ if(rAttGra.pFill == pFill
+ && rAttGra.pStepCount == pStepCount)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+UINT16 TextureAttributesGradient::GetTextureAttributeType() const
+{
+ return TEXTURE_ATTRIBUTE_TYPE_GRADIENT;
+}
+
+// Fuer Hatchfills
+
+TextureAttributesHatch::TextureAttributesHatch(void* pF)
+: TextureAttributes(),
+ pFill(pF)
+{
+}
+
+BOOL TextureAttributesHatch::operator==(const TextureAttributes& rAtt) const
+{
+ if(GetTextureAttributeType() == rAtt.GetTextureAttributeType())
+ {
+ const TextureAttributesHatch& rAttHat = (const TextureAttributesHatch&)rAtt;
+
+ if(rAttHat.pFill == pFill)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+UINT16 TextureAttributesHatch::GetTextureAttributeType() const
+{
+ return TEXTURE_ATTRIBUTE_TYPE_HATCH;
+}
+
+
+/*************************************************************************
+|*
+|* Konstruktor Textur
+|*
+\************************************************************************/
+
+B3dTexture::B3dTexture(
+ TextureAttributes& rAtt,
+ Bitmap& rBmp,
+ Base3DTextureKind eKnd,
+ Base3DTextureMode eMod,
+ Base3DTextureFilter eFlt,
+ Base3DTextureWrap eS,
+ Base3DTextureWrap eT)
+: aBitmap(rBmp),
+ pReadAccess(NULL),
+ nUsageCount(B3D_TEXTURE_LIFETIME),
+ eKind(eKnd),
+ eMode(eMod),
+ eFilter(eFlt),
+ eWrapS(eS),
+ eWrapT(eT),
+ nSwitchVal(0),
+ bTextureKindChanged(FALSE)
+{
+ // ReadAccess auf Textur anfordern
+ pReadAccess = aBitmap.AcquireReadAccess();
+ DBG_ASSERT(pReadAccess, "AW: Keinen Lesezugriff auf Textur-Bitmap bekommen");
+
+ // Attribute kopieren
+ switch(rAtt.GetTextureAttributeType())
+ {
+ case TEXTURE_ATTRIBUTE_TYPE_BITMAP :
+ pAttributes = new TextureAttributesBitmap(
+ ((TextureAttributesBitmap&)rAtt).GetBitmapAttribute());
+ break;
+
+ case TEXTURE_ATTRIBUTE_TYPE_GRADIENT :
+ pAttributes = new TextureAttributesGradient(
+ ((TextureAttributesGradient&)rAtt).GetFillAttribute(),
+ ((TextureAttributesGradient&)rAtt).GetStepCountAttribute());
+ break;
+
+ case TEXTURE_ATTRIBUTE_TYPE_HATCH :
+ pAttributes = new TextureAttributesHatch(
+ ((TextureAttributesHatch&)rAtt).GetHatchFillAttribute());
+ break;
+ }
+
+ // SwitchVal setzen
+ SetSwitchVal();
+}
+
+/*************************************************************************
+|*
+|* Destruktor Textur
+|*
+\************************************************************************/
+
+B3dTexture::~B3dTexture()
+{
+ // ReadAccess auf Textur freigeben
+ if(pReadAccess)
+ {
+ aBitmap.ReleaseAccess(pReadAccess);
+ pReadAccess = NULL;
+ }
+
+ // Attribute wegschmeissen
+ if(pAttributes)
+ delete pAttributes;
+ pAttributes = NULL;
+}
+
+// Zugriff auf die Attribute der Textur
+TextureAttributes& B3dTexture::GetAttributes()
+{
+ return *pAttributes;
+}
+
+/*************************************************************************
+|*
+|* Art des Wrappings in X setzen
+|*
+\************************************************************************/
+
+void B3dTexture::SetTextureWrapS(Base3DTextureWrap eNew)
+{
+ if(eNew != eWrapS)
+ {
+ eWrapS = eNew;
+ bTextureKindChanged = TRUE;
+ }
+}
+
+/*************************************************************************
+|*
+|* Art des Wrappings in Y setzen
+|*
+\************************************************************************/
+
+void B3dTexture::SetTextureWrapT(Base3DTextureWrap eNew)
+{
+ if(eNew != eWrapT)
+ {
+ eWrapT = eNew;
+ bTextureKindChanged = TRUE;
+ }
+}
+
+/*************************************************************************
+|*
+|* Blend-Color lesen/bestimmen
+|*
+\************************************************************************/
+
+void B3dTexture::SetBlendColor(Color rNew)
+{
+ if(rNew.GetRed() != aColBlend.GetRed()
+ || rNew.GetGreen() != aColBlend.GetGreen()
+ || rNew.GetBlue() != aColBlend.GetBlue())
+ {
+ aColBlend.SetRed(rNew.GetRed());
+ aColBlend.SetGreen(rNew.GetGreen());
+ aColBlend.SetBlue(rNew.GetBlue());
+ if(eWrapS == Base3DTextureSingle || eWrapT == Base3DTextureSingle)
+ bTextureKindChanged = TRUE;
+ }
+}
+
+Color B3dTexture::GetBlendColor()
+{
+ Color aRetval(aColBlend.GetRed(),
+ aColBlend.GetGreen(),
+ aColBlend.GetBlue());
+ return aRetval;
+}
+
+/*************************************************************************
+|*
+|* Textur-Ersatz-Color lesen/bestimmen
+|*
+\************************************************************************/
+
+void B3dTexture::SetTextureColor(Color rNew)
+{
+ if(rNew.GetRed() != aColTexture.GetRed()
+ || rNew.GetGreen() != aColTexture.GetGreen()
+ || rNew.GetBlue() != aColTexture.GetBlue())
+ {
+ aColTexture.SetRed(rNew.GetRed());
+ aColTexture.SetGreen(rNew.GetGreen());
+ aColTexture.SetBlue(rNew.GetBlue());
+ if(eWrapS == Base3DTextureSingle || eWrapT == Base3DTextureSingle)
+ bTextureKindChanged = TRUE;
+ }
+}
+
+Color B3dTexture::GetTextureColor()
+{
+ Color aRetval(aColTexture.GetRed(),
+ aColTexture.GetGreen(),
+ aColTexture.GetBlue());
+ return aRetval;
+}
+
+/*************************************************************************
+|*
+|* Internen Verteilungswert setzen
+|*
+\************************************************************************/
+
+void B3dTexture::SetSwitchVal()
+{
+ nSwitchVal = 0;
+
+ // Kind
+ if(GetTextureKind() == Base3DTextureLuminance)
+ nSwitchVal |= B3D_TXT_KIND_LUM;
+ else if(GetTextureKind() == Base3DTextureIntensity)
+ nSwitchVal |= B3D_TXT_KIND_INT;
+ else if(GetTextureKind() == Base3DTextureColor)
+ nSwitchVal |= B3D_TXT_KIND_COL;
+
+ // Mode
+ if(GetTextureMode() == Base3DTextureReplace)
+ nSwitchVal |= B3D_TXT_MODE_REP;
+ else if(GetTextureMode() == Base3DTextureModulate)
+ nSwitchVal |= B3D_TXT_MODE_MOD;
+ else if(GetTextureMode() == Base3DTextureBlend)
+ nSwitchVal |= B3D_TXT_MODE_BND;
+
+ // Filter
+ if(GetTextureFilter() == Base3DTextureNearest)
+ nSwitchVal |= B3D_TXT_FLTR_NEA;
+}
+
+/*************************************************************************
+|*
+|* Zugriffsfunktion auf die Farben der Bitmap
+|*
+\************************************************************************/
+
+const BitmapColor B3dTexture::GetBitmapColor(long nX, long nY)
+{
+ return pReadAccess->GetColor(nY, nX);
+}
+
+/*************************************************************************
+|*
+|* Art der Pixeldaten lesen/bestimmen
+|*
+\************************************************************************/
+
+void B3dTexture::SetTextureKind(Base3DTextureKind eNew)
+{
+ if(eKind != eNew)
+ {
+ eKind = eNew;
+ bTextureKindChanged = TRUE;
+ }
+ SetSwitchVal();
+}
+
+/*************************************************************************
+|*
+|* Texturmodus lesen/bestimmen
+|*
+\************************************************************************/
+
+void B3dTexture::SetTextureMode(Base3DTextureMode eNew)
+{
+ eMode = eNew;
+ SetSwitchVal();
+}
+
+/*************************************************************************
+|*
+|* Filtermodus lesen/bestimmen
+|*
+\************************************************************************/
+
+void B3dTexture::SetTextureFilter(Base3DTextureFilter eNew)
+{
+ eFilter = eNew;
+ SetSwitchVal();
+}
+
+/*************************************************************************
+|*
+|* Die Texturfunktion selbst. Die ursruengliche Farbe des Punktes
+|* innerhalb der Grenzen des Parameterbereiches S,T (in Bitmapkoordinaten)
+|* wird modifiziert.
+|*
+\************************************************************************/
+
+void B3dTexture::ModifyColor(Color& rCol, double fS, double fT)
+{
+ // Integer-Koordinaten der Texturposition bilden
+ long nX((long)fS);
+ long nY((long)fT);
+ BitmapColor aBmCol = aColTexture;
+ BOOL bOnTexture(TRUE);
+
+ // Wrapping in S-Richtung
+ if(eWrapS == Base3DTextureClamp)
+ {
+ // Clamping
+ if(nX < 0)
+ nX = 0;
+ else if(nX >= GetBitmapSize().Width())
+ nX = GetBitmapSize().Width() - 1;
+ }
+ else if(eWrapS == Base3DTextureRepeat)
+ {
+ // Repeating
+ nX %= GetBitmapSize().Width();
+ if(nX < 0)
+ nX += GetBitmapSize().Width();
+ }
+ else
+ {
+ // Single
+ if(nX < 0 || nX >= GetBitmapSize().Width())
+ bOnTexture = FALSE;
+ }
+
+ // Wrapping in T-Richtung
+ if(bOnTexture)
+ {
+ if(eWrapT == Base3DTextureClamp)
+ {
+ // Clamping
+ if(nY < 0)
+ nY = 0;
+ else if(nY >= GetBitmapSize().Height())
+ nY = GetBitmapSize().Height() - 1;
+ }
+ else if(eWrapT == Base3DTextureRepeat)
+ {
+ // Repeating
+ nY %= GetBitmapSize().Height();
+ if(nY < 0)
+ nY += GetBitmapSize().Height();
+ }
+ else
+ {
+ // Single
+ if(nY < 0 || nY >= GetBitmapSize().Height())
+ bOnTexture = FALSE;
+ }
+
+ if(bOnTexture)
+ aBmCol = pReadAccess->GetColor(nY, nX);
+ }
+
+ // Falls die Position nicht innerhalb der Textur ist, auch das Filtern
+ // unterdruecken um keine falschen BitmapAcesses zu bekommen
+ UINT8 nLocalSwitchVal(nSwitchVal);
+ if(!bOnTexture)
+ nLocalSwitchVal |= B3D_TXT_FLTR_NEA;
+
+ switch(nLocalSwitchVal)
+ {
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_REP|B3D_TXT_KIND_COL) :
+ {
+ rCol.SetRed(aBmCol.GetRed());
+ rCol.SetGreen(aBmCol.GetGreen());
+ rCol.SetBlue(aBmCol.GetBlue());
+ break;
+ }
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_MOD|B3D_TXT_KIND_COL) :
+ {
+ rCol.SetRed((UINT8)( ((UINT16)rCol.GetRed() * (UINT16)aBmCol.GetRed())>>8 ));
+ rCol.SetGreen((UINT8)( ((UINT16)rCol.GetGreen() * (UINT16)aBmCol.GetGreen())>>8 ));
+ rCol.SetBlue((UINT8)( ((UINT16)rCol.GetBlue() * (UINT16)aBmCol.GetBlue())>>8 ));
+ break;
+ }
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_BND|B3D_TXT_KIND_COL) :
+ {
+ rCol.SetRed((UINT8)( ((UINT16)rCol.GetRed() * (0x00ff - (UINT16)aBmCol.GetRed()))
+ + ((UINT16)aColBlend.GetRed() * (UINT16)aBmCol.GetRed()) ));
+ rCol.SetGreen((UINT8)( ((UINT16)rCol.GetGreen() * (0x00ff - (UINT16)aBmCol.GetGreen()))
+ + ((UINT16)aColBlend.GetGreen() * (UINT16)aBmCol.GetGreen()) ));
+ rCol.SetBlue((UINT8)( ((UINT16)rCol.GetBlue() * (0x00ff - (UINT16)aBmCol.GetBlue()))
+ + ((UINT16)aColBlend.GetBlue() * (UINT16)aBmCol.GetBlue()) ));
+ break;
+ }
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_REP|B3D_TXT_KIND_INT) :
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_REP|B3D_TXT_KIND_LUM) :
+ {
+ rCol.SetRed((aBmCol.GetRed() + aBmCol.GetGreen() + aBmCol.GetBlue()) / 3);
+ rCol.SetGreen(rCol.GetRed());
+ rCol.SetBlue(rCol.GetRed());
+ break;
+ }
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_MOD|B3D_TXT_KIND_INT) :
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_MOD|B3D_TXT_KIND_LUM) :
+ {
+ UINT16 nMidCol = (aBmCol.GetRed() + aBmCol.GetGreen() + aBmCol.GetBlue()) / 3;
+ rCol.SetRed((UINT8)( ((UINT16)rCol.GetRed() * nMidCol)>>8 ));
+ rCol.SetGreen((UINT8)( ((UINT16)rCol.GetGreen() * nMidCol)>>8 ));
+ rCol.SetBlue((UINT8)( ((UINT16)rCol.GetBlue() * nMidCol)>>8 ));
+ break;
+ }
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_BND|B3D_TXT_KIND_INT) :
+ case (B3D_TXT_FLTR_NEA|B3D_TXT_MODE_BND|B3D_TXT_KIND_LUM) :
+ {
+ UINT16 nMidCol = (aBmCol.GetRed() + aBmCol.GetGreen() + aBmCol.GetBlue()) / 3;
+ UINT16 nInvMidCol = 0x00ff - nMidCol;
+ rCol.SetRed((UINT8)( ((UINT16)rCol.GetRed() * nInvMidCol)
+ + ((UINT16)aColBlend.GetRed() * nMidCol) ));
+ rCol.SetGreen((UINT8)( ((UINT16)rCol.GetGreen() * nInvMidCol)
+ + ((UINT16)aColBlend.GetGreen() * nMidCol) ));
+ rCol.SetBlue((UINT8)( ((UINT16)rCol.GetBlue() * nInvMidCol)
+ + ((UINT16)aColBlend.GetBlue() * nMidCol) ));
+ break;
+ }
+ case (B3D_TXT_MODE_REP|B3D_TXT_KIND_COL) :
+ {
+ fS = fS - floor(fS);
+ fT = fT - floor(fT);
+ long nX2, nY2;
+
+ if(fS > 0.5) {
+ nX2 = (nX + 1) % GetBitmapSize().Width();
+ fS = 1.0 - fS;
+ } else
+ nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
+
+ if(fT > 0.5) {
+ nY2 = (nY + 1) % GetBitmapSize().Height();
+ fT = 1.0 - fT;
+ } else
+ nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
+
+ fS += 0.5;
+ fT += 0.5;
+ double fRight = 1.0 - fS;
+ double fBottom = 1.0 - fT;
+
+ BitmapColor aColTL = pReadAccess->GetColor(nY, nX);
+ BitmapColor aColTR = pReadAccess->GetColor(nY, nX2);
+ BitmapColor aColBL = pReadAccess->GetColor(nY2, nX);
+ BitmapColor aColBR = pReadAccess->GetColor(nY2, nX2);
+
+ rCol.SetRed((UINT8)(((double)aColTL.GetRed() * fS + (double)aColTR.GetRed() * fRight) * fT
+ + ((double)aColBL.GetRed() * fS + (double)aColBR.GetRed() * fRight) * fBottom));
+ rCol.SetGreen((UINT8)(((double)aColTL.GetGreen() * fS + (double)aColTR.GetGreen() * fRight) * fT
+ + ((double)aColBL.GetGreen() * fS + (double)aColBR.GetGreen() * fRight) * fBottom));
+ rCol.SetBlue((UINT8)(((double)aColTL.GetBlue() * fS + (double)aColTR.GetBlue() * fRight) * fT
+ + ((double)aColBL.GetBlue() * fS + (double)aColBR.GetBlue() * fRight) * fBottom));
+ break;
+ }
+ case (B3D_TXT_MODE_MOD|B3D_TXT_KIND_COL) :
+ {
+ fS = fS - floor(fS);
+ fT = fT - floor(fT);
+ long nX2, nY2;
+
+ if(fS > 0.5) {
+ nX2 = (nX + 1) % GetBitmapSize().Width();
+ fS = 1.0 - fS;
+ } else
+ nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
+
+ if(fT > 0.5) {
+ nY2 = (nY + 1) % GetBitmapSize().Height();
+ fT = 1.0 - fT;
+ } else
+ nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
+
+ fS += 0.5;
+ fT += 0.5;
+ double fRight = 1.0 - fS;
+ double fBottom = 1.0 - fT;
+
+ BitmapColor aColTL = pReadAccess->GetColor(nY, nX);
+ BitmapColor aColTR = pReadAccess->GetColor(nY, nX2);
+ BitmapColor aColBL = pReadAccess->GetColor(nY2, nX);
+ BitmapColor aColBR = pReadAccess->GetColor(nY2, nX2);
+
+ double fRed = ((double)aColTL.GetRed() * fS + (double)aColTR.GetRed() * fRight) * fT
+ + ((double)aColBL.GetRed() * fS + (double)aColBR.GetRed() * fRight) * fBottom;
+ double fGreen = ((double)aColTL.GetGreen() * fS + (double)aColTR.GetGreen() * fRight) * fT
+ + ((double)aColBL.GetGreen() * fS + (double)aColBR.GetGreen() * fRight) * fBottom;
+ double fBlue = ((double)aColTL.GetBlue() * fS + (double)aColTR.GetBlue() * fRight) * fT
+ + ((double)aColBL.GetBlue() * fS + (double)aColBR.GetBlue() * fRight) * fBottom;
+
+ rCol.SetRed((UINT8)(((double)rCol.GetRed() * fRed) / 255.0));
+ rCol.SetGreen((UINT8)(((double)rCol.GetGreen() * fGreen) / 255.0));
+ rCol.SetBlue((UINT8)(((double)rCol.GetBlue() * fBlue) / 255.0));
+ break;
+ }
+ case (B3D_TXT_MODE_BND|B3D_TXT_KIND_COL) :
+ {
+ fS = fS - floor(fS);
+ fT = fT - floor(fT);
+ long nX2, nY2;
+
+ if(fS > 0.5) {
+ nX2 = (nX + 1) % GetBitmapSize().Width();
+ fS = 1.0 - fS;
+ } else
+ nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
+
+ if(fT > 0.5) {
+ nY2 = (nY + 1) % GetBitmapSize().Height();
+ fT = 1.0 - fT;
+ } else
+ nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
+
+ fS += 0.5;
+ fT += 0.5;
+ double fRight = 1.0 - fS;
+ double fBottom = 1.0 - fT;
+
+ BitmapColor aColTL = pReadAccess->GetColor(nY, nX);
+ BitmapColor aColTR = pReadAccess->GetColor(nY, nX2);
+ BitmapColor aColBL = pReadAccess->GetColor(nY2, nX);
+ BitmapColor aColBR = pReadAccess->GetColor(nY2, nX2);
+
+ double fRed = ((double)aColTL.GetRed() * fS + (double)aColTR.GetRed() * fRight) * fT
+ + ((double)aColBL.GetRed() * fS + (double)aColBR.GetRed() * fRight) * fBottom;
+ double fGreen = ((double)aColTL.GetGreen() * fS + (double)aColTR.GetGreen() * fRight) * fT
+ + ((double)aColBL.GetGreen() * fS + (double)aColBR.GetGreen() * fRight) * fBottom;
+ double fBlue = ((double)aColTL.GetBlue() * fS + (double)aColTR.GetBlue() * fRight) * fT
+ + ((double)aColBL.GetBlue() * fS + (double)aColBR.GetBlue() * fRight) * fBottom;
+
+ rCol.SetRed((UINT8)((((double)rCol.GetRed() * (255.0 - fRed)) + ((double)aColBlend.GetRed() * fRed)) / 255.0));
+ rCol.SetGreen((UINT8)((((double)rCol.GetGreen() * (255.0 - fGreen)) + ((double)aColBlend.GetGreen() * fGreen)) / 255.0));
+ rCol.SetBlue((UINT8)((((double)rCol.GetBlue() * (255.0 - fBlue)) + ((double)aColBlend.GetBlue() * fBlue)) / 255.0));
+ break;
+ }
+ case (B3D_TXT_MODE_REP|B3D_TXT_KIND_INT) :
+ case (B3D_TXT_MODE_REP|B3D_TXT_KIND_LUM) :
+ {
+ fS = fS - floor(fS);
+ fT = fT - floor(fT);
+ long nX2, nY2;
+
+ if(fS > 0.5) {
+ nX2 = (nX + 1) % GetBitmapSize().Width();
+ fS = 1.0 - fS;
+ } else
+ nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
+
+ if(fT > 0.5) {
+ nY2 = (nY + 1) % GetBitmapSize().Height();
+ fT = 1.0 - fT;
+ } else
+ nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
+
+ fS += 0.5;
+ fT += 0.5;
+ double fRight = 1.0 - fS;
+ double fBottom = 1.0 - fT;
+
+ UINT8 nMidVal = (UINT8)((
+ (double)pReadAccess->GetLuminance(nY, nX) * fS +
+ (double)pReadAccess->GetLuminance(nY, nX2) * fRight) * fT + (
+ (double)pReadAccess->GetLuminance(nY2, nX) * fS +
+ (double)pReadAccess->GetLuminance(nY2, nX2) * fRight) * fBottom);
+
+ rCol.SetRed(nMidVal);
+ rCol.SetGreen(nMidVal);
+ rCol.SetBlue(nMidVal);
+ break;
+ }
+ case (B3D_TXT_MODE_MOD|B3D_TXT_KIND_INT) :
+ case (B3D_TXT_MODE_MOD|B3D_TXT_KIND_LUM) :
+ {
+ fS = fS - floor(fS);
+ fT = fT - floor(fT);
+ long nX2, nY2;
+
+ if(fS > 0.5) {
+ nX2 = (nX + 1) % GetBitmapSize().Width();
+ fS = 1.0 - fS;
+ } else
+ nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
+
+ if(fT > 0.5) {
+ nY2 = (nY + 1) % GetBitmapSize().Height();
+ fT = 1.0 - fT;
+ } else
+ nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
+
+ fS += 0.5;
+ fT += 0.5;
+ double fRight = 1.0 - fS;
+ double fBottom = 1.0 - fT;
+
+ double fMidVal = (
+ (double)pReadAccess->GetLuminance(nY, nX) * fS +
+ (double)pReadAccess->GetLuminance(nY, nX2) * fRight) * fT + (
+ (double)pReadAccess->GetLuminance(nY2, nX) * fS +
+ (double)pReadAccess->GetLuminance(nY2, nX2) * fRight) * fBottom;
+
+ rCol.SetRed((UINT8)(((double)rCol.GetRed() * fMidVal) / 255.0));
+ rCol.SetGreen((UINT8)(((double)rCol.GetGreen() * fMidVal) / 255.0));
+ rCol.SetBlue((UINT8)(((double)rCol.GetBlue() * fMidVal) / 255.0));
+ break;
+ }
+ case (B3D_TXT_MODE_BND|B3D_TXT_KIND_INT) :
+ case (B3D_TXT_MODE_BND|B3D_TXT_KIND_LUM) :
+ {
+ fS = fS - floor(fS);
+ fT = fT - floor(fT);
+ long nX2, nY2;
+
+ if(fS > 0.5) {
+ nX2 = (nX + 1) % GetBitmapSize().Width();
+ fS = 1.0 - fS;
+ } else
+ nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
+
+ if(fT > 0.5) {
+ nY2 = (nY + 1) % GetBitmapSize().Height();
+ fT = 1.0 - fT;
+ } else
+ nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
+
+ fS += 0.5;
+ fT += 0.5;
+ double fRight = 1.0 - fS;
+ double fBottom = 1.0 - fT;
+
+ double fMidVal = (
+ (double)pReadAccess->GetLuminance(nY, nX) * fS +
+ (double)pReadAccess->GetLuminance(nY, nX2) * fRight) * fT + (
+ (double)pReadAccess->GetLuminance(nY2, nX) * fS +
+ (double)pReadAccess->GetLuminance(nY2, nX2) * fRight) * fBottom;
+ double fInvMidVal(255.0 - fMidVal);
+
+ rCol.SetRed((UINT8)((((double)rCol.GetRed() * fInvMidVal) + ((double)aColBlend.GetRed() * fMidVal)) / 255.0));
+ rCol.SetGreen((UINT8)((((double)rCol.GetGreen() * fInvMidVal) + ((double)aColBlend.GetGreen() * fMidVal)) / 255.0));
+ rCol.SetBlue((UINT8)((((double)rCol.GetBlue() * fInvMidVal) + ((double)aColBlend.GetBlue() * fMidVal)) / 255.0));
+ break;
+ }
+ }
+
+// Funktionsfaehige Version komplett auf double precision und
+// kuerzesten Pfaden
+//
+// // Parameter fuer Farbe der Texturstelle bereitstellen
+// double fRed, fGreen, fBlue;
+//
+// // Eventuell glaetten?
+// if(GetTextureFilter() == Base3DTextureLinear)
+// {
+// // Filtern
+// double fLeft = fS - floor(fS);
+// double fTop = fT - floor(fT);
+// double fRight, fBottom;
+// long nX2, nY2;
+//
+// if(fLeft > 0.5)
+// {
+// nX2 = (nX + 1) % GetBitmapSize().Width();
+// fLeft = (1.0 - fLeft) + 0.5;
+// fRight = 1.0 - fLeft;
+// }
+// else
+// {
+// nX2 = nX ? nX - 1 : GetBitmapSize().Width() - 1;
+// fLeft = fLeft + 0.5;
+// fRight = 1.0 - fLeft;
+// }
+//
+//
+// if(fTop > 0.5)
+// {
+// nY2 = (nY + 1) % GetBitmapSize().Height();
+// fTop = (1.0 - fTop) + 0.5;
+// fBottom = 1.0 - fTop;
+// }
+// else
+// {
+// nY2 = nY ? nY - 1 : GetBitmapSize().Height() - 1;
+// fTop = fTop + 0.5;
+// fBottom = 1.0 - fTop;
+// }
+//
+// const BitmapColor& rColTL = GetBitmapColor(nX, nY);
+// const BitmapColor& rColTR = GetBitmapColor(nX2, nY);
+// const BitmapColor& rColBL = GetBitmapColor(nX, nY2);
+// const BitmapColor& rColBR = GetBitmapColor(nX2, nY2);
+//
+// fRed = ((double)rColTL.GetRed() * fLeft + (double)rColTR.GetRed() * fRight) * fTop
+// + ((double)rColBL.GetRed() * fLeft + (double)rColBR.GetRed() * fRight) * fBottom;
+//
+// fGreen = ((double)rColTL.GetGreen() * fLeft + (double)rColTR.GetGreen() * fRight) * fTop
+// + ((double)rColBL.GetGreen() * fLeft + (double)rColBR.GetGreen() * fRight) * fBottom;
+//
+// fBlue = ((double)rColTL.GetBlue() * fLeft + (double)rColTR.GetBlue() * fRight) * fTop
+// + ((double)rColBL.GetBlue() * fLeft + (double)rColBR.GetBlue() * fRight) * fBottom;
+// }
+// else
+// {
+// // Nearest Pixel
+// const BitmapColor& rBmCol = GetBitmapColor(nX, nY);
+// fRed = (double)rBmCol.GetRed();
+// fGreen = (double)rBmCol.GetGreen();
+// fBlue = (double)rBmCol.GetBlue();
+// }
+//
+// // Jetzt anhand der TextureKind entscheiden
+// if(eKind == Base3DTextureColor)
+// {
+// if(eMode == Base3DTextureReplace)
+// {
+// rCol.SetRed((UINT8)fRed);
+// rCol.SetGreen((UINT8)fGreen);
+// rCol.SetBlue((UINT8)fBlue);
+// }
+// else if(eMode == Base3DTextureModulate)
+// {
+// rCol.SetRed((UINT8)(((double)rCol.GetRed() * fRed) / 255.0));
+// rCol.SetGreen((UINT8)(((double)rCol.GetGreen() * fGreen) / 255.0));
+// rCol.SetBlue((UINT8)(((double)rCol.GetBlue() * fBlue) / 255.0));
+// }
+// else // Base3DTextureBlend
+// {
+// rCol.SetRed((UINT8)((((double)rCol.GetRed() * (255.0 - fRed)) + ((double)aColBlend.GetRed() * fRed)) / 255.0));
+// rCol.SetGreen((UINT8)((((double)rCol.GetGreen() * (255.0 - fGreen)) + ((double)aColBlend.GetGreen() * fGreen)) / 255.0));
+// rCol.SetBlue((UINT8)((((double)rCol.GetBlue() * (255.0 - fBlue)) + ((double)aColBlend.GetBlue() * fBlue)) / 255.0));
+// }
+// }
+// else
+// {
+// double fMidVal((fRed + fGreen + fBlue) / 3.0);
+// if(eMode == Base3DTextureReplace)
+// {
+// rCol.SetRed((UINT8)fMidVal);
+// rCol.SetGreen((UINT8)fMidVal);
+// rCol.SetBlue((UINT8)fMidVal);
+// }
+// else if(eMode == Base3DTextureModulate)
+// {
+// rCol.SetRed((UINT8)(((double)rCol.GetRed() * fMidVal) / 255.0));
+// rCol.SetGreen((UINT8)(((double)rCol.GetGreen() * fMidVal) / 255.0));
+// rCol.SetBlue((UINT8)(((double)rCol.GetBlue() * fMidVal) / 255.0));
+// }
+// else // Base3DTextureBlend
+// {
+// double fInvMidVal(255.0 - fMidVal);
+// rCol.SetRed((UINT8)((((double)rCol.GetRed() * fInvMidVal) + ((double)aColBlend.GetRed() * fRed)) / 255.0));
+// rCol.SetGreen((UINT8)((((double)rCol.GetGreen() * fInvMidVal) + ((double)aColBlend.GetGreen() * fGreen)) / 255.0));
+// rCol.SetBlue((UINT8)((((double)rCol.GetBlue() * fInvMidVal) + ((double)aColBlend.GetBlue() * fBlue)) / 255.0));
+// }
+// }
+}
+
+/*************************************************************************
+|*
+|* Konstruktor TexturOpenGL
+|*
+\************************************************************************/
+
+B3dTextureOpenGL::B3dTextureOpenGL(
+ TextureAttributes& rAtt,
+ Bitmap& rBmp,
+ OpenGL& rOGL,
+ Base3DTextureKind eKnd,
+ Base3DTextureMode eMod,
+ Base3DTextureFilter eFlt,
+ Base3DTextureWrap eS,
+ Base3DTextureWrap eT)
+: B3dTexture(rAtt, rBmp, eKnd, eMod, eFlt, eS, eT),
+ nTextureName(0)
+{
+ // TextureName anfordern
+ rOGL.GenTextures(1, &nTextureName);
+}
+
+/*************************************************************************
+|*
+|* Destruktor TexturOpenGL
+|*
+\************************************************************************/
+
+B3dTextureOpenGL::~B3dTextureOpenGL()
+{
+}
+
+/*************************************************************************
+|*
+|* In OpenGL die Textur zerstoeren
+|*
+\************************************************************************/
+
+void B3dTextureOpenGL::DestroyOpenGLTexture(OpenGL& rOpenGL)
+{
+ // OpenGL Textur wieder freigeben
+ rOpenGL.DeleteTextures(1, &nTextureName);
+}
+
+/*************************************************************************
+|*
+|* Setze diese Textur in OpenGL als aktuelle Textur
+|*
+\************************************************************************/
+
+void B3dTextureOpenGL::MakeCurrentTexture(OpenGL& rOpenGL)
+{
+ // Eventuell Textur erst erzeugen?
+ if(!rOpenGL.IsTexture(nTextureName) || bTextureKindChanged)
+ {
+ // Textur erzeugen und binden
+ CreateOpenGLTexture(rOpenGL);
+ }
+ else
+ {
+ // Jetzt Textur binden
+ rOpenGL.BindTexture(GL_TEXTURE_2D, nTextureName);
+ }
+
+ // Nun die Parameter an der Textur setzen
+ switch(GetTextureWrapS())
+ {
+ case Base3DTextureSingle :
+ case Base3DTextureClamp :
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ break;
+ case Base3DTextureRepeat :
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ break;
+ }
+ switch(GetTextureWrapT())
+ {
+ case Base3DTextureSingle :
+ case Base3DTextureClamp :
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ break;
+ case Base3DTextureRepeat :
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ break;
+ }
+ switch(GetTextureFilter())
+ {
+ case Base3DTextureNearest :
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ break;
+ case Base3DTextureLinear :
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ rOpenGL.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ break;
+ }
+ switch(GetTextureMode())
+ {
+ case Base3DTextureReplace :
+ rOpenGL.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ break;
+ case Base3DTextureModulate :
+ rOpenGL.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ break;
+ case Base3DTextureBlend :
+ {
+ rOpenGL.TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
+ float fArray[4] = {
+ ((float)GetBlendColor().GetRed()) / (float)255.0,
+ ((float)GetBlendColor().GetGreen()) / (float)255.0,
+ ((float)GetBlendColor().GetBlue()) / (float)255.0,
+ ((float)GetBlendColor().GetTransparency()) / (float)255.0
+ };
+ rOpenGL.TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fArray);
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Erzeuge diese Textur als OpenGL-Textur
+|*
+\************************************************************************/
+
+void B3dTextureOpenGL::CreateOpenGLTexture(OpenGL& rOpenGL)
+{
+ Size aSize(0,0);
+
+ // Groesse entscheiden (auf 1024 begrenzen)
+ for(UINT16 a=1;a<0x0400 && (!aSize.Width() || !aSize.Height());a<<=1)
+ {
+ if(!aSize.Width() && (a>=GetBitmapSize().Width()))
+ aSize.Width() = a;
+ if(!aSize.Height() && (a>=GetBitmapSize().Height()))
+ aSize.Height() = a;
+ }
+
+ // begrenzen falls groesser als 1024
+ if(!aSize.Width())
+ aSize.Width() = 0x0400;
+ if(!aSize.Height())
+ aSize.Height() = 0x0400;
+
+ // Minimalgroesse garantieren, auch an 4Byte-Alignment denken
+ // falls hier mal geaendert wird... (siehe OpenGL Bitmap Befehle)
+ if(aSize.Width() < 8)
+ aSize.Width() = 8;
+ if(aSize.Height() < 8)
+ aSize.Height() = 8;
+
+ // Skalierte Bitmap anlegen
+ Bitmap aBitmap(GetBitmap());
+ if(aSize != GetBitmapSize())
+ aBitmap.Scale((double)aSize.Width() / (double)GetBitmapSize().Width(),
+ (double)aSize.Height() / (double)GetBitmapSize().Height());
+
+ // Falls es sich um eine nur einmal zu wiederholende Bitmap
+ // handelt, lege nun eine mit einem definierten Rand an
+ if(GetTextureWrapS() == Base3DTextureSingle
+ || GetTextureWrapT() == Base3DTextureSingle)
+ {
+ Bitmap aHelpBitmap(aBitmap);
+ Size aNewSize(aSize);
+ Point aNewPos(0, 0);
+
+ if(GetTextureWrapS() == Base3DTextureSingle)
+ {
+ aNewSize.Width() -= 4;
+ aNewPos.X() = 2;
+ }
+ if(GetTextureWrapT() == Base3DTextureSingle)
+ {
+ aNewSize.Height() -= 4;
+ aNewPos.Y() = 2;
+ }
+
+ aHelpBitmap.Scale((double)aNewSize.Width() / (double)aSize.Width(),
+ (double)aNewSize.Height() / (double)aSize.Height());
+ Color aEraseCol = GetTextureColor();
+ aBitmap.Erase(aEraseCol);
+ Point aPoint;
+ Rectangle aCopySrc(aPoint, aNewSize);
+ Rectangle aCopyDest(aNewPos, aNewSize);
+ aBitmap.CopyPixel(aCopyDest, aCopySrc, &aHelpBitmap);
+ }
+
+ // Lesezugriff auf neue Bitmap holen
+ BitmapReadAccess* pReadAccess = aBitmap.AcquireReadAccess();
+ if(pReadAccess)
+ {
+ // Buffer holen
+ long nSize = aSize.Width() * aSize.Height();
+ if(GetTextureKind() == Base3DTextureColor)
+ nSize *= 3;
+ GL_UINT8 pBuffer = (GL_UINT8)SvMemAlloc(nSize);
+
+ if(pBuffer)
+ {
+ // Daten kopieren
+ GL_UINT8 pRunner = pBuffer;
+ if(GetTextureKind() == Base3DTextureColor)
+ {
+ if(pReadAccess->HasPalette())
+ {
+ for(long a=0;aGetPaletteColor(
+ pReadAccess->GetPixel(a, b));
+ *pRunner++ = rCol.GetRed();
+ *pRunner++ = rCol.GetGreen();
+ *pRunner++ = rCol.GetBlue();
+ }
+ }
+ }
+ else
+ {
+ for(long a=0;aGetPixel(a, b);
+ *pRunner++ = rCol.GetRed();
+ *pRunner++ = rCol.GetGreen();
+ *pRunner++ = rCol.GetBlue();
+ }
+ }
+ }
+ }
+ else
+ {
+ if(pReadAccess->HasPalette())
+ {
+ for(long a=0;aGetPaletteColor(
+ pReadAccess->GetPixel(a, b));
+ *pRunner++ = (rCol.GetRed() + rCol.GetGreen() + rCol.GetBlue()) / 3;
+ }
+ }
+ }
+ else
+ {
+ for(long a=0;aGetPixel(a, b);
+ *pRunner++ = (rCol.GetRed() + rCol.GetGreen() + rCol.GetBlue()) / 3;
+ }
+ }
+ }
+ }
+
+ // Textur das erste mal binden und damit initialisieren
+ rOpenGL.BindTexture(GL_TEXTURE_2D, nTextureName);
+
+ // Jetzt ein glTexImage2D() ausfuehren
+ GLint nInternalFormat;
+ GLint nFormat;
+
+ switch(GetTextureKind())
+ {
+ case Base3DTextureLuminance:
+ nInternalFormat = GL_LUMINANCE;
+ nFormat = GL_LUMINANCE;
+ break;
+ case Base3DTextureIntensity:
+ nInternalFormat = GL_INTENSITY;
+ nFormat = GL_LUMINANCE;
+ break;
+ case Base3DTextureColor:
+ nInternalFormat = GL_RGB;
+ nFormat = GL_RGB;
+ break;
+ }
+
+ rOpenGL.TexImage2D(GL_TEXTURE_2D, 0, nInternalFormat,
+ (GLsizei)aSize.Width(),
+ (GLsizei)aSize.Height(),
+ 0, nFormat, GL_UNSIGNED_BYTE, pBuffer);
+
+ SvMemFree(pBuffer);
+ }
+
+ // Lesezugriff freigeben
+ aBitmap.ReleaseAccess(pReadAccess);
+ }
+
+ // Hinweis auf Veraenderung der Texturart auf jeden Fall elliminieren
+ bTextureKindChanged = FALSE;
+}
+
diff --git a/goodies/source/base3d/b3dtrans.cxx b/goodies/source/base3d/b3dtrans.cxx
new file mode 100644
index 000000000000..0765e2adc001
--- /dev/null
+++ b/goodies/source/base3d/b3dtrans.cxx
@@ -0,0 +1,936 @@
+/*************************************************************************
+ *
+ * $RCSfile: b3dtrans.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_B3DTRANS_HXX
+#include "b3dtrans.hxx"
+#endif
+
+#ifndef _B3D_BASE3D_HXX
+#include "base3d.hxx"
+#endif
+
+#ifndef _B3D_VOLUM_HXX
+#include "b3dvolum.hxx"
+#endif
+
+/*************************************************************************
+|*
+|* Transformationen fuer alle 3D Ausgaben
+|*
+\************************************************************************/
+
+B3dTransformationSet::B3dTransformationSet()
+{
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Reset der Werte
+|*
+\************************************************************************/
+
+void B3dTransformationSet::Reset()
+{
+ // Matritzen auf Einheitsmatritzen
+ aObjectTrans.Identity();
+ PostSetObjectTrans();
+
+ aOrientation.Orientation();
+ PostSetOrientation();
+
+ aTexture.Identity();
+
+ fLeftBound = fBottomBound = -1.0;
+ fRightBound = fTopBound = 1.0;
+ fNearBound = 0.001;
+ fFarBound = 1.001;
+
+ eRatio = Base3DRatioGrow;
+ fRatio = 0.0;
+
+ aViewportRectangle = Rectangle(-1, -1, 2, 2);
+ aVisibleRectangle = aViewportRectangle;
+
+ bPerspective = TRUE;
+
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+
+ CalcViewport();
+}
+
+/*************************************************************************
+|*
+|* Objekttransformation
+|*
+\************************************************************************/
+
+void B3dTransformationSet::SetObjectTrans(Matrix4D& rObj)
+{
+ aObjectTrans = rObj;
+
+ bObjectToDeviceValid = FALSE;
+ bInvTransObjectToEyeValid = FALSE;
+
+ PostSetObjectTrans();
+}
+
+void B3dTransformationSet::PostSetObjectTrans()
+{
+ // Zuweisen und Inverse bestimmen
+ aInvObjectTrans = aObjectTrans;
+ aInvObjectTrans.Invert();
+}
+
+/*************************************************************************
+|*
+|* Orientierungstransformation
+|*
+\************************************************************************/
+
+#ifndef ICC
+void B3dTransformationSet::SetOrientation( Vector3D& aVRP, Vector3D& aVPN, Vector3D& aVUP)
+#else
+void B3dTransformationSet::SetOrientation( Vector3D aVRP, Vector3D aVPN, Vector3D aVUP)
+#endif
+{
+ aOrientation.Identity();
+ aOrientation.Orientation(Point4D(aVRP), aVPN, aVUP);
+
+ bInvTransObjectToEyeValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+
+ PostSetOrientation();
+}
+
+void B3dTransformationSet::SetOrientation(Matrix4D& mOrient)
+{
+ aOrientation = mOrient;
+
+ bInvTransObjectToEyeValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+
+ PostSetOrientation();
+}
+
+void B3dTransformationSet::PostSetOrientation()
+{
+ // Zuweisen und Inverse bestimmen
+ aInvOrientation = aOrientation;
+ aInvOrientation.Invert();
+}
+
+/*************************************************************************
+|*
+|* Projektionstransformation
+|*
+\************************************************************************/
+
+void B3dTransformationSet::SetProjection(Matrix4D& mProject)
+{
+ aProjection = mProject;
+ PostSetProjection();
+}
+
+const Matrix4D& B3dTransformationSet::GetProjection()
+{
+ if(!bProjectionValid)
+ CalcViewport();
+ return aProjection;
+}
+
+const Matrix4D& B3dTransformationSet::GetInvProjection()
+{
+ if(!bProjectionValid)
+ CalcViewport();
+ return aInvProjection;
+}
+
+void B3dTransformationSet::PostSetProjection()
+{
+ // Zuweisen und Inverse bestimmen
+ aInvProjection = GetProjection();
+ aInvProjection.Invert();
+
+ // Abhaengige Matritzen invalidieren
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+}
+
+/*************************************************************************
+|*
+|* Texturtransformation
+|*
+\************************************************************************/
+
+void B3dTransformationSet::SetTexture(Matrix4D& rTxt)
+{
+ aTexture = rTxt;
+ PostSetTexture();
+}
+
+void B3dTransformationSet::PostSetTexture()
+{
+}
+
+/*************************************************************************
+|*
+|* Viewport-Transformation
+|*
+\************************************************************************/
+
+void B3dTransformationSet::CalcViewport()
+{
+ // Faktoren fuer die Projektion
+ double fLeft = fLeftBound;
+ double fRight = fRightBound;
+ double fBottom = fBottomBound;
+ double fTop = fTopBound;
+
+ // Soll das Seitenverhaeltnis Beachtung finden?
+ // Falls ja, Bereich der Projektion an Seitenverhaeltnis anpassen
+ if(GetRatio() != 0.0)
+ {
+ // Berechne aktuelles Seitenverhaeltnis der Bounds
+ double fBoundWidth = (double)(aViewportRectangle.GetWidth() + 1);
+ double fBoundHeight = (double)(aViewportRectangle.GetHeight() + 1);
+ double fActRatio;
+ double fFactor;
+
+ if(fBoundWidth != 0.0)
+ fActRatio = fBoundHeight / fBoundWidth;
+
+ switch(eRatio)
+ {
+ case Base3DRatioShrink :
+ {
+ // Kleineren Teil vergroessern
+ if(fActRatio > fRatio)
+ {
+ // X vergroessern
+ fFactor = 1.0 / fActRatio;
+ fRight *= fFactor;
+ fLeft *= fFactor;
+ }
+ else
+ {
+ // Y vergroessern
+ fFactor = fActRatio;
+ fTop *= fFactor;
+ fBottom *= fFactor;
+ }
+ break;
+ }
+ case Base3DRatioGrow :
+ {
+ // GroesserenTeil verkleinern
+ if(fActRatio > fRatio)
+ {
+ // Y verkleinern
+ fFactor = fActRatio;
+ fTop *= fFactor;
+ fBottom *= fFactor;
+ }
+ else
+ {
+ // X verkleinern
+ fFactor = 1.0 / fActRatio;
+ fRight *= fFactor;
+ fLeft *= fFactor;
+ }
+ break;
+ }
+ case Base3DRatioMiddle :
+ {
+ // Mitteln
+ fFactor = ((1.0 / fActRatio) + 1.0) / 2.0;
+ fRight *= fFactor;
+ fLeft *= fFactor;
+ fFactor = (fActRatio + 1.0) / 2.0;
+ fTop *= fFactor;
+ fBottom *= fFactor;
+ break;
+ }
+ }
+ }
+
+ // Ueberschneiden sich Darstellungsflaeche und Objektflaeche?
+ aSetBound = aViewportRectangle;
+
+ // Mit den neuen Werten Projektion und ViewPort setzen
+ Matrix4D aNewProjection;
+ double fDistPart = (fFarBound - fNearBound) * SMALL_DVALUE;
+
+ // Near, Far etwas grosszuegiger setzen, um falsches,
+ // zu kritisches clippen zu verhindern
+ if(bPerspective)
+ aNewProjection.Frustum(fLeft, fRight, fBottom, fTop,
+ fNearBound - fDistPart, fFarBound + fDistPart);
+ else
+ aNewProjection.Ortho(fLeft, fRight, fBottom, fTop,
+ fNearBound - fDistPart, fFarBound + fDistPart);
+
+ // jetzt schon auf gueltig setzen um Endlosschleife zu vermeiden
+ bProjectionValid = TRUE;
+
+ // Neue Projektion setzen
+ SetProjection(aNewProjection);
+
+ // fill parameters for ViewportTransformation
+ // Translation
+ aTranslate[0] = (double)aSetBound.Left() + ((aSetBound.GetWidth() - 1L) / 2.0);
+ aTranslate[1] = (double)aSetBound.Top() + ((aSetBound.GetHeight() - 1L) / 2.0);
+ aTranslate[2] = ZBUFFER_DEPTH_RANGE / 2.0;
+
+ // Skalierung
+ aScale[0] = (aSetBound.GetWidth() - 1L) / 2.0;
+ aScale[1] = (aSetBound.GetHeight() - 1L) / -2.0;
+ aScale[2] = ZBUFFER_DEPTH_RANGE / 2.0;
+
+ // Auf Veraenderung des ViewPorts reagieren
+ PostSetViewport();
+}
+
+void B3dTransformationSet::SetRatio(double fNew)
+{
+ if(fRatio != fNew)
+ {
+ fRatio = fNew;
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+ }
+}
+
+void B3dTransformationSet::SetRatioMode(Base3DRatio eNew)
+{
+ if(eRatio != eNew)
+ {
+ eRatio = eNew;
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+ }
+}
+
+void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, double fT,
+ BOOL bBroadCastChange)
+{
+ if(fL != fLeftBound || fR != fRightBound || fB != fBottomBound || fT != fTopBound)
+ {
+ fLeftBound = fL;
+ fRightBound = fR;
+ fBottomBound = fB;
+ fTopBound = fT;
+
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+
+ // Aenderung bekanntmachen
+ if(bBroadCastChange)
+ DeviceRectangleChange();
+ }
+}
+
+void B3dTransformationSet::SetDeviceVolume(const B3dVolume& rVol, BOOL bBroadCastChange)
+{
+ SetDeviceRectangle(rVol.MinVec().X(), rVol.MaxVec().X(),
+ rVol.MinVec().Y(), rVol.MaxVec().Y(), bBroadCastChange);
+ SetFrontClippingPlane(rVol.MinVec().Z());
+ SetBackClippingPlane(rVol.MaxVec().Z());
+}
+
+void B3dTransformationSet::DeviceRectangleChange()
+{
+}
+
+void B3dTransformationSet::GetDeviceRectangle(double &fL, double &fR, double& fB, double& fT)
+{
+ fL = fLeftBound;
+ fR = fRightBound;
+ fB = fBottomBound;
+ fT = fTopBound;
+
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+}
+
+B3dVolume B3dTransformationSet::GetDeviceVolume()
+{
+ B3dVolume aRet;
+ aRet.MinVec() = Vector3D(fLeftBound, fBottomBound, fNearBound);
+ aRet.MaxVec() = Vector3D(fRightBound, fTopBound, fFarBound);
+ return aRet;
+}
+
+void B3dTransformationSet::SetFrontClippingPlane(double fF)
+{
+ if(fNearBound != fF)
+ {
+ fNearBound = fF;
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+ }
+}
+
+void B3dTransformationSet::SetBackClippingPlane(double fB)
+{
+ if(fFarBound != fB)
+ {
+ fFarBound = fB;
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+ }
+}
+
+void B3dTransformationSet::SetPerspective(BOOL bNew)
+{
+ if(bPerspective != bNew)
+ {
+ bPerspective = bNew;
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+ }
+}
+
+void B3dTransformationSet::SetViewportRectangle(Rectangle& rRect, Rectangle& rVisible)
+{
+ if(rRect != aViewportRectangle || rVisible != aVisibleRectangle)
+ {
+ aViewportRectangle = rRect;
+ aVisibleRectangle = rVisible;
+
+ bProjectionValid = FALSE;
+ bObjectToDeviceValid = FALSE;
+ bWorldToViewValid = FALSE;
+ }
+}
+
+void B3dTransformationSet::PostSetViewport()
+{
+}
+
+const Rectangle& B3dTransformationSet::GetLogicalViewportBounds()
+{
+ if(!bProjectionValid)
+ CalcViewport();
+ return aSetBound;
+}
+
+const Vector3D& B3dTransformationSet::GetScale()
+{
+ if(!bProjectionValid)
+ CalcViewport();
+ return aScale;
+}
+
+const Vector3D& B3dTransformationSet::GetTranslate()
+{
+ if(!bProjectionValid)
+ CalcViewport();
+ return aTranslate;
+}
+
+/*************************************************************************
+|*
+|* Hilfsmatrixberechnungsroutinen
+|*
+\************************************************************************/
+
+void B3dTransformationSet::CalcMatObjectToDevice()
+{
+ // ObjectToDevice berechnen (Orientation * Projection * Object)
+ aObjectToDevice = aObjectTrans;
+ aObjectToDevice *= aOrientation;
+ aObjectToDevice *= GetProjection();
+
+ // auf gueltig setzen
+ bObjectToDeviceValid = TRUE;
+}
+
+const Matrix4D& B3dTransformationSet::GetObjectToDevice()
+{
+ if(!bObjectToDeviceValid)
+ CalcMatObjectToDevice();
+ return aObjectToDevice;
+}
+
+void B3dTransformationSet::CalcMatInvTransObjectToEye()
+{
+ aInvTransObjectToEye = aObjectTrans;
+ aInvTransObjectToEye *= aOrientation;
+ aInvTransObjectToEye.Invert();
+ aInvTransObjectToEye.Transpose();
+
+ // eventuelle Translationen rausschmeissen, da diese
+ // Matrix nur zur Transformation von Vektoren gedacht ist
+ aInvTransObjectToEye[3] = Point4D(0.0, 0.0, 0.0, 1.0);
+
+ // auf gueltig setzen
+ bInvTransObjectToEyeValid = TRUE;
+}
+
+const Matrix4D& B3dTransformationSet::GetInvTransObjectToEye()
+{
+ if(!bInvTransObjectToEyeValid)
+ CalcMatInvTransObjectToEye();
+ return aInvTransObjectToEye;
+}
+
+Matrix4D B3dTransformationSet::GetMatFromObjectToView()
+{
+ Matrix4D aFromObjectToView = GetObjectToDevice();
+
+ aFromObjectToView.Scale(GetScale());
+ aFromObjectToView.Translate(GetTranslate());
+
+ return aFromObjectToView;
+}
+
+void B3dTransformationSet::CalcMatFromWorldToView()
+{
+ aMatFromWorldToView = aOrientation;
+ aMatFromWorldToView *= GetProjection();
+ aMatFromWorldToView.Scale(GetScale());
+ aMatFromWorldToView.Translate(GetTranslate());
+ aInvMatFromWorldToView = aMatFromWorldToView;
+ aInvMatFromWorldToView.Invert();
+
+ // gueltig setzen
+ bWorldToViewValid = TRUE;
+}
+
+const Matrix4D& B3dTransformationSet::GetMatFromWorldToView()
+{
+ if(!bWorldToViewValid)
+ CalcMatFromWorldToView();
+ return aMatFromWorldToView;
+}
+
+const Matrix4D& B3dTransformationSet::GetInvMatFromWorldToView()
+{
+ if(!bWorldToViewValid)
+ CalcMatFromWorldToView();
+ return aInvMatFromWorldToView;
+}
+
+/*************************************************************************
+|*
+|* Direkter Zugriff auf verschiedene Transformationen
+|*
+\************************************************************************/
+
+const Vector3D B3dTransformationSet::WorldToEyeCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetOrientation();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::EyeToWorldCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetInvOrientation();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::EyeToViewCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetProjection();
+ aVec *= GetScale();
+ aVec += GetTranslate();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::ViewToEyeCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec -= GetTranslate();
+ aVec = aVec / GetScale();
+ aVec *= GetInvProjection();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::WorldToViewCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetMatFromWorldToView();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::ViewToWorldCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetInvMatFromWorldToView();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::DeviceToViewCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetScale();
+ aVec += GetTranslate();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::ViewToDeviceCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec -= GetTranslate();
+ aVec = aVec / GetScale();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::ObjectToWorldCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetObjectTrans();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::WorldToObjectCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetInvObjectTrans();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::ObjectToViewCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetObjectTrans();
+ aVec *= GetMatFromWorldToView();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::ViewToObjectCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetInvMatFromWorldToView();
+ aVec *= GetInvObjectTrans();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::ObjectToEyeCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetObjectTrans();
+ aVec *= GetOrientation();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::EyeToObjectCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetInvOrientation();
+ aVec *= GetInvObjectTrans();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::DeviceToEyeCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetInvProjection();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::EyeToDeviceCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetProjection();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::InvTransObjectToEye(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetInvTransObjectToEye();
+ return aVec;
+}
+
+const Vector3D B3dTransformationSet::TransTextureCoor(const Vector3D& rVec)
+{
+ Vector3D aVec(rVec);
+ aVec *= GetTexture();
+ return aVec;
+}
+
+/*************************************************************************
+|*
+|* Konstruktor B3dViewport
+|*
+\************************************************************************/
+
+B3dViewport::B3dViewport()
+: B3dTransformationSet(),
+ aVRP(0, 0, 0),
+ aVPN(0, 0, 1),
+ aVUV(0, 1, 0)
+{
+ CalcOrientation();
+}
+
+void B3dViewport::SetVRP(const Vector3D& rNewVRP)
+{
+ aVRP = rNewVRP;
+ CalcOrientation();
+}
+
+void B3dViewport::SetVPN(const Vector3D& rNewVPN)
+{
+ aVPN = rNewVPN;
+ CalcOrientation();
+}
+
+void B3dViewport::SetVUV(const Vector3D& rNewVUV)
+{
+ aVUV = rNewVUV;
+ CalcOrientation();
+}
+
+void B3dViewport::SetViewportValues(
+ const Vector3D& rNewVRP,
+ const Vector3D& rNewVPN,
+ const Vector3D& rNewVUV)
+{
+ aVRP = rNewVRP;
+ aVPN = rNewVPN;
+ aVUV = rNewVUV;
+ CalcOrientation();
+}
+
+void B3dViewport::CalcOrientation()
+{
+ SetOrientation(aVRP, aVPN, aVUV);
+}
+
+/*************************************************************************
+|*
+|* Konstruktor B3dViewport
+|*
+\************************************************************************/
+
+B3dCamera::B3dCamera(const Vector3D& rPos, const Vector3D& rLkAt,
+ double fFocLen, double fBnkAng, BOOL bUseFocLen)
+: B3dViewport(),
+ aPosition(rPos),
+ aCorrectedPosition(rPos),
+ aLookAt(rLkAt),
+ fFocalLength(fFocLen),
+ fBankAngle(fBnkAng),
+ bUseFocalLength(bUseFocLen)
+{
+ CalcNewViewportValues();
+}
+
+void B3dCamera::SetPosition(const Vector3D& rNewPos)
+{
+ if(rNewPos != aPosition)
+ {
+ // Zuweisen
+ aCorrectedPosition = aPosition = rNewPos;
+
+ // Neuberechnung
+ CalcNewViewportValues();
+ }
+}
+
+void B3dCamera::SetLookAt(const Vector3D& rNewLookAt)
+{
+ if(rNewLookAt != aLookAt)
+ {
+ // Zuweisen
+ aLookAt = rNewLookAt;
+
+ // Neuberechnung
+ CalcNewViewportValues();
+ }
+}
+
+void B3dCamera::SetPositionAndLookAt(const Vector3D& rNewPos, const Vector3D& rNewLookAt)
+{
+ if(rNewPos != aPosition || rNewLookAt != aLookAt)
+ {
+ // Zuweisen
+ aPosition = rNewPos;
+ aLookAt = rNewLookAt;
+
+ // Neuberechnung
+ CalcNewViewportValues();
+ }
+}
+
+void B3dCamera::SetFocalLength(double fLen)
+{
+ if(fLen != fFocalLength)
+ {
+ // Zuweisen
+ if(fLen < 5.0)
+ fLen = 5.0;
+ fFocalLength = fLen;
+
+ // Neuberechnung
+ CalcNewViewportValues();
+ }
+}
+
+void B3dCamera::SetBankAngle(double fAngle)
+{
+ if(fAngle != fBankAngle)
+ {
+ // Zuweisen
+ fBankAngle = fAngle;
+
+ // Neuberechnung
+ CalcNewViewportValues();
+ }
+}
+
+void B3dCamera::SetUseFocalLength(BOOL bNew)
+{
+ if(bNew != (BOOL)bUseFocalLength)
+ {
+ // Zuweisen
+ bUseFocalLength = bNew;
+
+ // Neuberechnung
+ CalcNewViewportValues();
+ }
+}
+
+void B3dCamera::DeviceRectangleChange()
+{
+ // call parent
+ B3dViewport::DeviceRectangleChange();
+
+ // Auf Aenderung reagieren
+ CalcNewViewportValues();
+}
+
+void B3dCamera::CalcNewViewportValues()
+{
+ Vector3D aViewVector = aPosition - aLookAt;
+ Vector3D aNewVPN = aViewVector;
+
+ Vector3D aNewVUV(0.0, 1.0, 0.0);
+ if(aNewVPN.GetLength() < aNewVPN.Y())
+ aNewVUV.X() = 0.5;
+
+ aNewVUV.Normalize();
+ aNewVPN.Normalize();
+
+ Vector3D aNewToTheRight = aNewVPN;
+ aNewToTheRight |= aNewVUV;
+ aNewToTheRight.Normalize();
+ aNewVUV = aNewToTheRight | aNewVPN;
+ aNewVUV.Normalize();
+
+ SetViewportValues(aPosition, aNewVPN, aNewVUV);
+ if(CalcFocalLength())
+ SetViewportValues(aCorrectedPosition, aNewVPN, aNewVUV);
+
+ if(fBankAngle != 0.0)
+ {
+ Matrix4D aRotMat;
+ aRotMat.RotateZ(fBankAngle);
+ Vector3D aUp(0.0, 1.0, 0.0);
+ aUp *= aRotMat;
+ aUp = EyeToWorldCoor(aUp);
+ aUp.Normalize();
+ SetVUV(aUp);
+ }
+}
+
+BOOL B3dCamera::CalcFocalLength()
+{
+ double fWidth = GetDeviceRectangleWidth();
+ BOOL bRetval = FALSE;
+
+ if(bUseFocalLength)
+ {
+ // Position aufgrund der FocalLength korrigieren
+ aCorrectedPosition = Vector3D(0.0, 0.0, fFocalLength * fWidth / 35.0);
+ aCorrectedPosition = EyeToWorldCoor(aCorrectedPosition);
+ bRetval = TRUE;
+ }
+ else
+ {
+ // FocalLength anhand der Position anpassen
+ Vector3D aOldPosition;
+ aOldPosition = WorldToEyeCoor(aOldPosition);
+ if(fWidth != 0.0)
+ fFocalLength = aOldPosition.Z() / fWidth * 35.0;
+ if(fFocalLength < 5.0)
+ fFocalLength = 5.0;
+ }
+ return bRetval;
+}
+
diff --git a/goodies/source/base3d/base3d.cxx b/goodies/source/base3d/base3d.cxx
new file mode 100644
index 000000000000..6a45cb2fb01d
--- /dev/null
+++ b/goodies/source/base3d/base3d.cxx
@@ -0,0 +1,1268 @@
+/*************************************************************************
+ *
+ * $RCSfile: base3d.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_BASE3D_HXX
+#include "base3d.hxx"
+#endif
+
+#ifndef _B3D_B3DENTITY_HXX
+#include "b3dentty.hxx"
+#endif
+
+#ifndef _B3D_B3DTEX_HXX
+#include "b3dtex.hxx"
+#endif
+
+#ifndef _B3D_B3DOPNGL_HXX
+#include "b3dopngl.hxx"
+#endif
+
+#ifndef _B3D_B3DDEFLT_HXX
+#include "b3ddeflt.hxx"
+#endif
+
+#ifndef _B3D_B3DPRINT_HXX
+#include "b3dprint.hxx"
+#endif
+
+#ifndef _B3D_B3DGEOM_HXX
+#include "b3dgeom.hxx"
+#endif
+
+#ifndef _B3D_B3DTRANS_HXX
+#include "b3dtrans.hxx"
+#endif
+
+#ifndef _SHL_HXX
+#include
+#endif
+
+#ifndef _SV_POLY_HXX
+#include
+#endif
+
+#ifndef _SFXINIPROP_HXX
+#include
+#endif
+
+#ifndef _SFXINIMGR_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Konstruktor B3dGlobalData
+|*
+\************************************************************************/
+
+B3dGlobalData::B3dGlobalData()
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor B3dGlobalData
+|*
+\************************************************************************/
+
+B3dGlobalData::~B3dGlobalData()
+{
+}
+
+/*************************************************************************
+|*
+|* Konstruktor Base3D
+|*
+\************************************************************************/
+
+Base3D::Base3D(OutputDevice* pOutDev)
+: OutDev3D(),
+ pDevice(pOutDev),
+ eObjectMode(Base3DPoints),
+ aCurrentColor(Color(0xff, 0xff, 0xff)),
+ aComplexPolygon(),
+ eRenderModeFront(Base3DRenderFill),
+ eRenderModeBack(Base3DRenderFill),
+ eShadeModel(Base3DSmooth),
+ eCullMode(Base3DCullNone),
+ fPointSize(1.0),
+ fLineWidth(1.0),
+ pActiveTexture(NULL),
+ pTransformationSet(NULL),
+ pLightGroup(NULL),
+ aMaterialFront(),
+ aMaterialBack(),
+ nDisplayQuality(127),
+ bEdgeFlag(TRUE),
+ bContextIsValid(TRUE),
+ bPolyOffsetFill(FALSE),
+ bPolyOffsetLine(FALSE),
+ bPolyOffsetPoint(FALSE),
+ bScissorRegionActive(FALSE),
+ bDitherActive(TRUE)
+{
+ // Grundsaetzliche Materialeigenschaften setzen
+ ResetMaterial(Base3DMaterialFrontAndBack);
+
+ // Fuer OS/2 die FP-Exceptions abschalten
+#if defined(OS2)
+#define SC_FPEXCEPTIONS_ON() _control87( MCW_EM, 0 )
+#define SC_FPEXCEPTIONS_OFF() _control87( MCW_EM, MCW_EM )
+ SC_FPEXCEPTIONS_OFF();
+#endif
+
+ // Fuer WIN95/NT die FP-Exceptions abschalten
+#if defined(WNT) || defined(WIN)
+#define SC_FPEXCEPTIONS_ON() _control87( _MCW_EM, 0 )
+#define SC_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
+ SC_FPEXCEPTIONS_OFF();
+#endif
+}
+
+/*************************************************************************
+|*
+|* Destruktor Base3D
+|*
+\************************************************************************/
+
+Base3D::~Base3D()
+{
+}
+
+/*************************************************************************
+|*
+|* Erzeuge einen Base3D Kontext in Anhaengigkeit vom uebergebenen
+|* OutputDevice und trage Ihn dort ein
+|*
+\************************************************************************/
+
+Base3D* Base3D::Create(OutputDevice* pOutDev, BOOL bForcePrinter)
+{
+ Base3D* pRetval = NULL;
+ if(pOutDev)
+ {
+ // Anforderungen feststellen
+ BOOL bOwnDevice = FALSE;
+ if(pOutDev->GetOutDevType() == OUTDEV_VIRDEV
+ || pOutDev->GetOutDevType() == OUTDEV_PRINTER
+ || pOutDev->GetConnectMetaFile() != NULL)
+ bOwnDevice = TRUE;
+
+ // Existiert schon ein 3D-Kontext, der auch an dieses
+ // OutputDevice gebunden ist?
+ if(pOutDev->Get3DContext()
+ && ((Base3D*)(pOutDev->Get3DContext()))->GetOutputDevice() == pOutDev)
+ {
+ pRetval = (Base3D*)pOutDev->Get3DContext();
+ }
+
+ // Falls Ja, ist er den Anforderungen gewachsen?
+ if(pRetval)
+ {
+ BOOL bForceNew(FALSE);
+
+ if((!bForceNew) && (bOwnDevice)&&(pRetval->GetBase3DType() == BASE3D_TYPE_OPENGL))
+ {
+ bForceNew = TRUE;
+ }
+
+ if((!bForceNew) && (bForcePrinter)&&(pRetval->GetBase3DType() != BASE3D_TYPE_PRINTER))
+ {
+ bForceNew = TRUE;
+ }
+
+ if((!bForceNew) && (!bForcePrinter)&&(pRetval->GetBase3DType() == BASE3D_TYPE_PRINTER))
+ {
+ bForceNew = TRUE;
+ }
+
+ if(!bForceNew && !bOwnDevice)
+ {
+ // Versuchen, einen OpenGL Kontext zu bekommen? Teste das
+ // globale Flag aus der .INI
+ BOOL bUseOpenGL = FALSE;
+ String aTmp = SfxIniManager::Get()->Get( SFX_KEY_3D_OPENGL );
+
+ if(aTmp.Len() && aTmp.GetChar(0) != sal_Unicode('0'))
+ bUseOpenGL = TRUE;
+
+ if((bUseOpenGL && pRetval->GetBase3DType() != BASE3D_TYPE_OPENGL)
+ || (!bUseOpenGL && pRetval->GetBase3DType() == BASE3D_TYPE_OPENGL))
+ {
+ bForceNew = TRUE;
+ bOwnDevice = !bUseOpenGL;
+ }
+ }
+
+ if(bForceNew)
+ {
+ pRetval->Destroy(pOutDev);
+ pRetval = NULL;
+ }
+ }
+
+ if(!pRetval)
+ {
+ // zerstoere altes Base3D, war nicht mehr an das
+ // OutputDevice gebunden
+ if(pOutDev->Get3DContext())
+ pOutDev->Get3DContext()->Destroy(pOutDev);
+
+ // erzeuge neues Base3D, je nach Anforderungen
+ if(bForcePrinter)
+ {
+ pRetval = new Base3DPrinter(pOutDev);
+ }
+ else if(bOwnDevice)
+ {
+ pRetval = new Base3DDefault(pOutDev);
+ }
+ else
+ {
+ // Versuche OpenGL, fallback auf default
+ // falls OpenGL nicht verfuegbar
+ pRetval = CreateScreenRenderer(pOutDev);
+ }
+
+ // 3D-Kontext eintragen als Renderer im angegebenen OutputDevice
+ if(pRetval)
+ pOutDev->Set3DContext((Base3D*)pRetval);
+ }
+ }
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* Versuche, einen 3D Kontext zur Bildschirmdarstellung zu generieren.
+|* Diese Funktion wird nur bei WNT realisiert. Sie muss entscheiden,
+|* ob OpenGL-DLL's verfuegbar sind und entsprechend den OpenGL
+|* Renderer oder einen Default Renderer erzeugen.
+|*
+\************************************************************************/
+
+Base3D* Base3D::CreateScreenRenderer(OutputDevice* pOutDev)
+{
+ // OpenGL Kontext erzeugen
+ Base3D* pRetval = NULL;
+
+ // Versuchen, einen OpenGL Kontext zu bekommen? Teste das
+ // globale Flag aus der .INI
+ BOOL bUseOpenGL = FALSE;
+ String aTmp = SfxIniManager::Get()->Get( SFX_KEY_3D_OPENGL );
+
+ if(aTmp.Len() && aTmp.GetChar(0) != sal_Unicode('0'))
+ bUseOpenGL = TRUE;
+
+ // Versuchen, einen OpenGL Kontext zu bekommen
+ if(bUseOpenGL)
+ pRetval = new Base3DOpenGL(pOutDev);
+
+ if(!pRetval || !pRetval->IsContextValid())
+ {
+ if(pRetval)
+ {
+ delete pRetval;
+ pRetval = NULL;
+ }
+ }
+
+ // versuche alternativ, einen Default Renderer zu inkarnieren
+ if(!pRetval)
+ pRetval = new Base3DDefault(pOutDev);
+
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* Entferne den Kontext aus dem assoziierten OutputDevice und zerstoere
+|* sich selbst
+|*
+|* Als Platzhalter fuer den Zeiger auf einen Kontext im OutputDevice
+|* wird momentan pTheCurrentBase3DIncarnation benutzt
+|*
+\************************************************************************/
+
+void Base3D::Destroy(OutputDevice *pOutDev)
+{
+ Base3D* pTmp;
+ if((pTmp = (Base3D*)GetOutputDevice()->Get3DContext()) == this)
+ {
+ GetOutputDevice()->Set3DContext(NULL);
+ delete pTmp;
+ }
+}
+
+/*************************************************************************
+|*
+|* TransformationSet setzen
+|*
+\************************************************************************/
+
+void Base3D::SetTransformationSet(B3dTransformationSet* pSet)
+{
+ // Aktuelles TransformationSet eintragen
+ pTransformationSet = pSet;
+}
+
+/*************************************************************************
+|*
+|* Beleuchtung setzen
+|*
+\************************************************************************/
+
+void Base3D::SetLightGroup(B3dLightGroup* pSet, BOOL bSetGlobal)
+{
+ // Aktuelle Beleuchtung eintragen
+ pLightGroup = pSet;
+}
+
+/*************************************************************************
+|*
+|* Scissoring Region setzen
+|*
+\************************************************************************/
+
+void Base3D::SetScissorRegionPixel(const Rectangle& rRect, BOOL bActivate)
+{
+ aScissorRectangle = rRect;
+ ActivateScissorRegion(bActivate);
+}
+
+void Base3D::SetScissorRegion(const Rectangle& rRect, BOOL bActivate)
+{
+ SetScissorRegionPixel(pDevice->LogicToPixel(rRect), bActivate);
+}
+
+/*************************************************************************
+|*
+|* Scissoring aktivieren/deaktivieren
+|*
+\************************************************************************/
+
+void Base3D::ActivateScissorRegion(BOOL bNew)
+{
+ if(bNew != bScissorRegionActive)
+ bScissorRegionActive = bNew;
+}
+
+/*************************************************************************
+|*
+|* Dithering setzen
+|*
+\************************************************************************/
+
+void Base3D::SetDither(BOOL bNew)
+{
+ bDitherActive = bNew;
+}
+
+/*************************************************************************
+|*
+|* Objektmodus holen
+|*
+\************************************************************************/
+
+Base3DObjectMode Base3D::GetObjectMode()
+{
+ return eObjectMode;
+}
+
+/*************************************************************************
+|*
+|* Ein neues Primitiv vom Typ nMode starten
+|*
+\************************************************************************/
+
+void Base3D::StartPrimitive(Base3DObjectMode eMode)
+{
+ eObjectMode = eMode;
+ if(eObjectMode > Base3DPolygon)
+ {
+ switch(eObjectMode)
+ {
+ case Base3DComplexPolygonCut :
+ {
+ // Neues Polygon beginnen
+ aComplexPolygon.SetTestForCut(TRUE);
+ aComplexPolygon.StartPrimitive();
+ break;
+ }
+ case Base3DComplexPolygon :
+ {
+ // Neues Polygon beginnen
+ aComplexPolygon.SetTestForCut(FALSE);
+ aComplexPolygon.StartPrimitive();
+ break;
+ }
+ }
+ }
+ else
+ {
+ ImplStartPrimitive();
+ }
+}
+
+/*************************************************************************
+|*
+|* Primitiv beenden
+|*
+\************************************************************************/
+
+void Base3D::EndPrimitive()
+{
+ if(eObjectMode > Base3DPolygon)
+ {
+ switch(eObjectMode)
+ {
+ case Base3DComplexPolygon :
+ case Base3DComplexPolygonCut :
+ {
+ // Selbst fuer Darstellung sorgen
+ aComplexPolygon.EndPrimitive(this);
+ break;
+ }
+ }
+ }
+ else
+ {
+ ImplEndPrimitive();
+ }
+}
+
+/*************************************************************************
+|*
+|* Ein Objekt in Form einer B3dGeometry direkt ausgeben
+|*
+\************************************************************************/
+
+void Base3D::DrawPolygonGeometry(B3dGeometry& rGeometry, BOOL bOutline)
+{
+ // Buckets der Geometrie holen
+ B3dEntityBucket& rEntityBucket = rGeometry.GetEntityBucket();
+ GeometryIndexValueBucket& rIndexBucket = rGeometry.GetIndexBucket();
+
+ UINT32 nPolyCounter = 0;
+ UINT32 nEntityCounter = 0;
+ UINT32 nUpperBound;
+
+ while(nPolyCounter < rIndexBucket.Count())
+ {
+ // Naechstes Primitiv
+ nUpperBound = rIndexBucket[nPolyCounter].GetIndex();
+
+ if(bOutline)
+ {
+ // Polygon als Outline ausgeben
+ SetRenderMode(Base3DRenderLine);
+ SetPolygonOffset(Base3DPolygonOffsetLine, TRUE);
+
+ // ALLE Linien Zeichnen
+ SetCullMode(Base3DCullNone);
+ }
+ else
+ {
+ // Polygone gefuellt ausgeben
+ SetRenderMode(Base3DRenderFill);
+ SetPolygonOffset(Base3DPolygonOffsetLine, FALSE);
+ }
+
+ if(rIndexBucket[nPolyCounter++].GetMode() == B3D_INDEX_MODE_LINE)
+ {
+ eObjectMode = Base3DLineStrip;
+ }
+ else
+ {
+ eObjectMode = Base3DPolygon;
+ }
+
+ // Neues Polygon beginnen
+ ImplStartPrimitive();
+
+ // Polygon ausgeben
+ while(nEntityCounter < nUpperBound)
+ {
+ B3dEntity& rEntity = ImplGetFreeEntity();
+ rEntity = rEntityBucket[nEntityCounter++];
+ if(bOutline)
+ {
+ rEntity.SetNormalUsed(FALSE);
+ rEntity.SetTexCoorUsed(FALSE);
+ SetEdgeFlag(rEntity.IsEdgeVisible());
+ }
+ ImplPostAddVertex(rEntity);
+ }
+
+ // Primitiv abschliessen
+ ImplEndPrimitive();
+ }
+}
+
+/*************************************************************************
+|*
+|* Direkter Zugriff auf B3dMaterial fuer abgeleitete Klassen
+|*
+\************************************************************************/
+
+B3dMaterial& Base3D::GetMaterialObject(Base3DMaterialMode eMode)
+{
+ if(eMode == Base3DMaterialFront)
+ return aMaterialFront;
+ return aMaterialBack;
+}
+
+/*************************************************************************
+|*
+|* geometrische Daten uebernehmen
+|*
+\************************************************************************/
+
+void Base3D::AddVertex(Vector3D& rVertex)
+{
+ // Platz fuer neue Daten holen
+ B3dEntity& rEntity = GetFreeEntity();
+ rEntity.Reset();
+
+ // geometrische Daten
+ rEntity.Point() = Point4D(rVertex);
+ rEntity.SetValid();
+
+ // Nachbehandlung
+ PostAddVertex(rEntity);
+}
+
+void Base3D::AddVertex(Vector3D& rVertex, Vector3D& rNormal)
+{
+ // Platz fuer neue Daten holen
+ B3dEntity& rEntity = GetFreeEntity();
+ rEntity.Reset();
+
+ // geometrische Daten
+ rEntity.Point() = Point4D(rVertex);
+ rEntity.SetValid();
+
+ // Normale
+ if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
+ {
+ rEntity.Normal() = rNormal;
+ rEntity.SetNormalUsed();
+ }
+
+ // Nachbehandlung
+ PostAddVertex(rEntity);
+}
+
+void Base3D::AddVertex(Vector3D& rVertex, Vector3D& rNormal,
+ Vector3D& rTexPos)
+{
+ // Platz fuer neue Daten holen
+ B3dEntity& rEntity = GetFreeEntity();
+ rEntity.Reset();
+
+ // geometrische Daten
+ rEntity.Point() = Point4D(rVertex);
+ rEntity.SetValid();
+
+ // Normale
+ if(GetLightGroup() && GetLightGroup()->IsLightingEnabled())
+ {
+ rEntity.Normal() = rNormal;
+ rEntity.SetNormalUsed();
+ }
+
+ // Texturdaten
+ rEntity.TexCoor() = rTexPos;
+ rEntity.SetTexCoorUsed();
+
+ // Nachbehandlung
+ PostAddVertex(rEntity);
+}
+
+void Base3D::AddVertex(B3dEntity& rEnt)
+{
+ // Platz fuer neue Daten holen
+ B3dEntity& rEntity = GetFreeEntity();
+
+ // Kopieren
+ rEntity = rEnt;
+
+ // Nachbehandlung
+ PostAddVertex(rEntity);
+}
+
+void Base3D::PostAddVertex(B3dEntity& rEntity)
+{
+ // Flag fuer die Sichtbarkeit von Kanten kopieren
+ rEntity.SetEdgeVisible(GetEdgeFlag());
+
+ // aktuelle Farbe eintragen
+ rEntity.Color().SetColor(GetColor().GetColor());
+
+ if(eObjectMode > Base3DPolygon)
+ {
+ switch(eObjectMode)
+ {
+ case Base3DComplexPolygon :
+ case Base3DComplexPolygonCut :
+ {
+ // Punkt ist nun ausgefuellt
+ aComplexPolygon.PostAddVertex(rEntity);
+ break;
+ }
+ }
+ }
+ else
+ {
+ ImplPostAddVertex(rEntity);
+ }
+}
+
+/*************************************************************************
+|*
+|* Platz fuer neuen Punkt anfordern
+|*
+\************************************************************************/
+
+B3dEntity& Base3D::GetFreeEntity()
+{
+ if(eObjectMode > Base3DPolygon)
+ {
+ switch(eObjectMode)
+ {
+ case Base3DComplexPolygon :
+ case Base3DComplexPolygonCut :
+ {
+ // Im eigenen Buffer anlegen
+ return aComplexPolygon.GetFreeEntity();
+ break;
+ }
+ }
+ }
+ return ImplGetFreeEntity();
+}
+
+/*************************************************************************
+|*
+|* Farbe setzen
+|*
+\************************************************************************/
+
+void Base3D::SetColor(Color aNew)
+{
+ // Farbe setzen
+ if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
+ {
+ // Graustufen
+ UINT8 nLuminance = aNew.GetLuminance();
+ aCurrentColor = Color(nLuminance, nLuminance, nLuminance);
+ }
+ else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
+ {
+ // Keine Ausgabe, hier Schwarz als Farbe setzen, wird
+ // als Linienfarbe benutzt
+ aCurrentColor = Color(COL_BLACK);
+ }
+ else
+ {
+ // Normale Farbausgabe
+ aCurrentColor = aNew;
+ }
+}
+
+/*************************************************************************
+|*
+|* Farbe liefern
+|*
+\************************************************************************/
+
+Color Base3D::GetColor()
+{
+ return aCurrentColor;
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften setzen
+|*
+\************************************************************************/
+
+void Base3D::SetMaterial(Color aNew,
+ Base3DMaterialValue eVal,
+ Base3DMaterialMode eMode)
+{
+ Color aSource;
+ if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
+ {
+ // Graustufen
+ UINT8 nLuminance = aNew.GetLuminance();
+ aSource.SetRed(nLuminance);
+ aSource.SetGreen(nLuminance);
+ aSource.SetBlue(nLuminance);
+ aSource.SetTransparency(aNew.GetTransparency());
+ }
+ else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
+ {
+ // Keine Ausgabe, hier Weiss als Farbe setzen
+ aSource = Color(COL_WHITE);
+ }
+ else
+ {
+ // Normale Farbausgabe
+ aSource = aNew;
+ }
+
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialFront)
+ {
+ aMaterialFront.SetMaterial(aSource, eVal);
+ }
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialBack)
+ {
+ aMaterialBack.SetMaterial(aSource, eVal);
+ }
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften abfragen
+|*
+\************************************************************************/
+
+Color Base3D::GetMaterial(Base3DMaterialValue eVal,
+ Base3DMaterialMode eMode)
+{
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialFront)
+ {
+ return aMaterialFront.GetMaterial(eVal);
+ }
+ return aMaterialBack.GetMaterial(eVal);
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften setzen, exponent der specular-Eigenschaft
+|*
+\************************************************************************/
+
+void Base3D::SetShininess(UINT16 nExponent,
+ Base3DMaterialMode eMode)
+{
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialFront)
+ {
+ aMaterialFront.SetShininess(nExponent);
+ }
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialBack)
+ {
+ aMaterialBack.SetShininess(nExponent);
+ }
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften abfragen, exponent der specular-Eigenschaft
+|*
+\************************************************************************/
+
+UINT16 Base3D::GetShininess(Base3DMaterialMode eMode)
+{
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialFront)
+ {
+ return aMaterialFront.GetShininess();
+ }
+ return aMaterialBack.GetShininess();
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften auf Ausgangszustand
+|*
+\************************************************************************/
+
+void Base3D::ResetMaterial(Base3DMaterialMode eMode)
+{
+ Color aColor(255, 51, 51, 51);
+ SetMaterial(aColor, Base3DMaterialAmbient, eMode);
+ aColor.SetColor(TRGB_COLORDATA(255, 204, 204, 204));
+ SetMaterial(aColor, Base3DMaterialDiffuse, eMode);
+ aColor.SetColor(TRGB_COLORDATA(255, 0, 0, 0));
+ SetMaterial(aColor, Base3DMaterialSpecular, eMode);
+ aColor.SetColor(TRGB_COLORDATA(255, 0, 0, 0));
+ SetMaterial(aColor, Base3DMaterialEmission, eMode);
+ SetShininess(0, eMode);
+}
+
+/*************************************************************************
+|*
+|* GlobalData holen
+|*
+\************************************************************************/
+
+B3dGlobalData& Base3D::GetGlobalData()
+{
+ B3dGlobalData** ppGlobalData = (B3dGlobalData**)GetAppData(SHL_BASE3D);
+ if(*ppGlobalData)
+ return **ppGlobalData;
+
+ // GlobalData anlegen
+ *ppGlobalData = new B3dGlobalData;
+ return **ppGlobalData;
+}
+
+/*************************************************************************
+|*
+|* TextureStore aus GlobalData holen
+|*
+\************************************************************************/
+
+B3dTextureStore& Base3D::GetTextureStore()
+{
+ return GetGlobalData().GetTextureStore();
+}
+
+/*************************************************************************
+|*
+|* Textur mit den angegebenen Attributen als Grundlage anfordern.
+|*
+\************************************************************************/
+
+B3dTexture* Base3D::ObtainTexture(TextureAttributes& rAtt)
+{
+ B3dTexture* pRetval = NULL;
+
+ // Textur suchen und bei Treffer zurueckgeben
+ B3dTextureStore& rTextureStore = GetTextureStore();
+ for(UINT16 a=0;aGetAttributes() == rAtt)
+ {
+ pRetval = rTextureStore[a];
+ pRetval->Touch();
+ }
+ else
+ {
+ rTextureStore[a]->DecrementUsageCount();
+
+ // Auf zu loeschende Texturen testen
+ if(!rTextureStore[a]->GetUsageCount())
+ {
+ B3dTexture *pTex = rTextureStore[a];
+ rTextureStore.Remove(a);
+ DestroyTexture(pTex);
+ a--;
+ }
+ }
+ }
+
+ // Textur zurueckgeben
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* Textur mit den angegebenen Attributen als Grundlage anfordern. Falls
+|* eine solche Textur nicht existiert, erzeuge eine und gib diese zurueck
+|*
+\************************************************************************/
+
+B3dTexture* Base3D::ObtainTexture(TextureAttributes& rAtt, Bitmap& rBitmap)
+{
+ B3dTexture* pRetval = ObtainTexture(rAtt);
+
+ if(!pRetval)
+ {
+ // Existiert tatsaechlich nicht, generiere eine neue Textur
+ B3dTextureStore& rTextureStore = GetTextureStore();
+
+ pRetval = CreateTexture(rAtt, rBitmap);
+ rTextureStore.Insert((const B3dTexture*&)pRetval, rTextureStore.Count());
+ }
+
+ // Textur zurueckgeben
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* Gezielt eine Textur freigeben
+|*
+\************************************************************************/
+
+void Base3D::DeleteTexture(TextureAttributes& rAtt)
+{
+ B3dTexture* pTexture = NULL;
+
+ // Textur suchen
+ B3dTextureStore& rTextureStore = GetTextureStore();
+ UINT16 a;
+ for(a=0;aGetAttributes() == rAtt)
+ {
+ pTexture = rTextureStore[a];
+ }
+ }
+
+ if(pTexture)
+ {
+ if(pTexture == pActiveTexture)
+ pActiveTexture = NULL;
+
+ rTextureStore.Remove(a);
+ DestroyTexture(pTexture);
+ }
+}
+
+/*************************************************************************
+|*
+|* Alle Texturen freigeben
+|*
+\************************************************************************/
+
+void Base3D::DeleteAllTextures()
+{
+ pActiveTexture = NULL;
+
+ B3dTextureStore& rTextureStore = GetTextureStore();
+ while(rTextureStore.Count())
+ {
+ B3dTexture *pTex = rTextureStore[0];
+ rTextureStore.Remove(0);
+ DestroyTexture(pTex);
+ }
+}
+
+/*************************************************************************
+|*
+|* Ein Textur-Objekt inkarnieren
+|*
+\************************************************************************/
+
+B3dTexture* Base3D::CreateTexture(TextureAttributes& rAtt, Bitmap& rBitmap)
+{
+ B3dTexture* pRetval = new B3dTexture(rAtt, rBitmap);
+ DBG_ASSERT(pRetval,"AW: Kein Speicher fuer Textur bekommen!");
+ return pRetval;
+}
+
+/*************************************************************************
+|*
+|* Normale Textur loeschen
+|*
+\************************************************************************/
+
+void Base3D::DestroyTexture(B3dTexture* pTex)
+{
+ delete pTex;
+}
+
+/*************************************************************************
+|*
+|* Aktuell zu benutzende Textur setzen
+|*
+\************************************************************************/
+
+void Base3D::SetActiveTexture(B3dTexture* pTex)
+{
+ if(pTex)
+ {
+ if(GetOutputDevice()->GetDrawMode() & DRAWMODE_GRAYFILL)
+ {
+ // Graustufen
+ pTex->SetTextureKind(Base3DTextureIntensity);
+ }
+ else if(GetOutputDevice()->GetDrawMode() & DRAWMODE_WHITEFILL)
+ {
+ // Keine Ausgabe, keine Textur setzen
+ pTex = NULL;
+ }
+ }
+
+ // ... und setzen
+ pActiveTexture = pTex;
+}
+
+/*************************************************************************
+|*
+|* Darstellungsqualitaet setzen
+|*
+\************************************************************************/
+
+void Base3D::SetDisplayQuality(UINT8 nNew)
+{
+ nDisplayQuality = nNew;
+}
+
+/*************************************************************************
+|*
+|* Darstellungsqualitaet lesen
+|*
+\************************************************************************/
+
+UINT8 Base3D::GetDisplayQuality()
+{
+ return nDisplayQuality;
+}
+
+/*************************************************************************
+|*
+|* PolygonOffset setzen
+|*
+\************************************************************************/
+
+void Base3D::SetPolygonOffset(Base3DPolygonOffset eNew, BOOL bNew)
+{
+ switch(eNew)
+ {
+ case Base3DPolygonOffsetFill :
+ bPolyOffsetFill = bNew;
+ break;
+
+ case Base3DPolygonOffsetLine :
+ bPolyOffsetLine = bNew;
+ break;
+
+ case Base3DPolygonOffsetPoint :
+ bPolyOffsetPoint = bNew;
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* PolygonOffset lesen
+|*
+\************************************************************************/
+
+BOOL Base3D::GetPolygonOffset(Base3DPolygonOffset eNew)
+{
+ if(eNew == Base3DPolygonOffsetLine)
+ return bPolyOffsetLine;
+ if(eNew == Base3DPolygonOffsetFill)
+ return bPolyOffsetFill;
+ return bPolyOffsetPoint;
+}
+
+/*************************************************************************
+|*
+|* EdgeFlag lesen
+|*
+\************************************************************************/
+
+BOOL Base3D::GetEdgeFlag()
+{
+ return bEdgeFlag;
+}
+
+/*************************************************************************
+|*
+|* EdgeFlag schreiben
+|*
+\************************************************************************/
+
+void Base3D::SetEdgeFlag(BOOL bNew)
+{
+ bEdgeFlag = bNew;
+}
+
+/*************************************************************************
+|*
+|* PointSize lesen
+|*
+\************************************************************************/
+
+double Base3D::GetPointSize()
+{
+ return fPointSize;
+}
+
+/*************************************************************************
+|*
+|* PointSize schreiben
+|*
+\************************************************************************/
+
+void Base3D::SetPointSize(double fNew)
+{
+ fPointSize = fNew;
+}
+
+/*************************************************************************
+|*
+|* LineWidth lesen
+|*
+\************************************************************************/
+
+double Base3D::GetLineWidth()
+{
+ return fLineWidth;
+}
+
+/*************************************************************************
+|*
+|* LineWidth schreiben
+|*
+\************************************************************************/
+
+void Base3D::SetLineWidth(double fNew)
+{
+ fLineWidth = fNew;
+}
+
+/*************************************************************************
+|*
+|* RenderMode setzen
+|*
+\************************************************************************/
+
+void Base3D::SetRenderMode(Base3DRenderMode eNew,
+ Base3DMaterialMode eMode)
+{
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialFront)
+ {
+ eRenderModeFront = eNew;
+ }
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialBack)
+ {
+ eRenderModeBack = eNew;
+ }
+}
+
+/*************************************************************************
+|*
+|* RenderMode lieferen
+|*
+\************************************************************************/
+
+Base3DRenderMode Base3D::GetRenderMode(Base3DMaterialMode eMode)
+{
+ if(eMode == Base3DMaterialFrontAndBack
+ || eMode == Base3DMaterialFront)
+ {
+ return eRenderModeFront;
+ }
+ return eRenderModeBack;
+}
+
+/*************************************************************************
+|*
+|* ShadeModel setzen
+|*
+\************************************************************************/
+
+void Base3D::SetShadeModel(Base3DShadeModel eNew)
+{
+ eShadeModel = eNew;
+}
+
+/*************************************************************************
+|*
+|* ShadeModel lieferen
+|*
+\************************************************************************/
+
+Base3DShadeModel Base3D::GetShadeModel()
+{
+ return eShadeModel;
+}
+
+/*************************************************************************
+|*
+|* CullingMode setzen
+|*
+\************************************************************************/
+
+void Base3D::SetCullMode(Base3DCullMode eNew)
+{
+ eCullMode = eNew;
+}
+
+/*************************************************************************
+|*
+|* CullingMode liefern
+|*
+\************************************************************************/
+
+Base3DCullMode Base3D::GetCullMode()
+{
+ return eCullMode;
+}
+
+/*************************************************************************
+|*
+|* Texturenverwaltung
+|*
+\************************************************************************/
+
+SV_IMPL_PTRARR(B3dTextureStore, B3dTexture*);
+
+
+#ifdef DBG_UTIL
+#include "b3dtest.cxx"
+#endif
+
diff --git a/goodies/source/base3d/makefile.mk b/goodies/source/base3d/makefile.mk
new file mode 100644
index 000000000000..925276be0378
--- /dev/null
+++ b/goodies/source/base3d/makefile.mk
@@ -0,0 +1,124 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=base3d
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+CXXFILES= \
+ base3d.cxx \
+ b3dtrans.cxx \
+ b3ddeflt.cxx \
+ b3dopngl.cxx \
+ b3dprint.cxx \
+ b3dcommn.cxx \
+ vector3d.cxx \
+ point4d.cxx \
+ matril3d.cxx \
+ b3dlight.cxx \
+ b3dcolor.cxx \
+ b3dentty.cxx \
+ b3dcompo.cxx \
+ hmatrix.cxx \
+ b3dtex.cxx \
+ b3dgeom.cxx \
+ b3dvolum.cxx
+
+#SRS1NAME=
+#SRC1FILES=
+
+SLOFILES= \
+ $(SLO)$/base3d.obj \
+ $(SLO)$/b3dtrans.obj \
+ $(SLO)$/b3ddeflt.obj \
+ $(SLO)$/b3dopngl.obj \
+ $(SLO)$/b3dprint.obj \
+ $(SLO)$/b3dcommn.obj \
+ $(SLO)$/vector3d.obj \
+ $(SLO)$/point4d.obj \
+ $(SLO)$/matril3d.obj \
+ $(SLO)$/b3dcolor.obj \
+ $(SLO)$/b3dlight.obj \
+ $(SLO)$/b3dentty.obj \
+ $(SLO)$/b3dcompo.obj \
+ $(SLO)$/hmatrix.obj \
+ $(SLO)$/b3dtex.obj \
+ $(SLO)$/b3dgeom.obj \
+ $(SLO)$/b3dvolum.obj
+
+
+.ENDIF # "$(header)" == ""
+
+.INCLUDE : target.mk
+
diff --git a/goodies/source/base3d/matril3d.cxx b/goodies/source/base3d/matril3d.cxx
new file mode 100644
index 000000000000..f0af32ac38e4
--- /dev/null
+++ b/goodies/source/base3d/matril3d.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * $RCSfile: matril3d.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _B3D_MATRIL3D_HXX
+#include "matril3d.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+
+/*************************************************************************
+|*
+|* Konstruktor B3dMaterial
+|*
+\************************************************************************/
+
+B3dMaterial::B3dMaterial()
+: aAmbient(COL_BLACK), // kein lokales Umgebungslicht
+ aDiffuse(0x00, 0xb8, 0xff), // Blau7
+ aSpecular(COL_WHITE), // Weisser Glanzpunkt
+ aEmission(COL_BLACK), // Keine Selbstleuchtfarbe
+ nExponent(15) // Glanzpunktbuendelung
+{
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaft setzen
+|*
+\************************************************************************/
+
+void B3dMaterial::SetMaterial(Color rNew, Base3DMaterialValue eVal)
+{
+ switch(eVal)
+ {
+ case Base3DMaterialAmbient:
+ aAmbient = rNew;
+ break;
+ case Base3DMaterialDiffuse:
+ aDiffuse = rNew;
+ break;
+ case Base3DMaterialSpecular:
+ aSpecular = rNew;
+ break;
+ case Base3DMaterialEmission:
+ aEmission = rNew;
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaft abfragen
+|*
+\************************************************************************/
+
+Color B3dMaterial::GetMaterial(Base3DMaterialValue eVal) const
+{
+ if(eVal == Base3DMaterialAmbient)
+ return aAmbient;
+ if(eVal == Base3DMaterialDiffuse)
+ return aDiffuse;
+ if(eVal == Base3DMaterialEmission)
+ return aEmission;
+ return aSpecular;
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften setzen, exponent der specular-Eigenschaft
+|*
+\************************************************************************/
+
+void B3dMaterial::SetShininess(UINT16 nNew)
+{
+ nExponent = nNew;
+}
+
+/*************************************************************************
+|*
+|* Materialeigenschaften abfragen, exponent der specular-Eigenschaft
+|*
+\************************************************************************/
+
+UINT16 B3dMaterial::GetShininess() const
+{
+ return nExponent;
+}
+
+void B3dMaterial::WriteData(SvStream& rOut) const
+{
+ rOut << aAmbient;
+ rOut << aDiffuse;
+ rOut << aSpecular;
+ rOut << aEmission;
+ rOut << nExponent;
+}
+
+void B3dMaterial::ReadData(SvStream& rIn)
+{
+ rIn >> aAmbient;
+ rIn >> aDiffuse;
+ rIn >> aSpecular;
+ rIn >> aEmission;
+ rIn >> nExponent;
+}
+
+/*************************************************************************
+|*
+|* Vergleichsoperator
+|*
+\************************************************************************/
+
+BOOL B3dMaterial::operator==(const B3dMaterial& rMat)
+{
+ if(aAmbient == rMat.aAmbient
+ && aDiffuse == rMat.aDiffuse
+ && aSpecular == rMat.aSpecular
+ && aEmission == rMat.aEmission
+ && nExponent == rMat.nExponent)
+ return TRUE;
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Bucket fuer geometrische Daten
+|*
+\************************************************************************/
+
+BASE3D_IMPL_BUCKET(B3dMaterial, Bucket)
+
diff --git a/goodies/source/filter.vcl/egif/dlgegif.cxx b/goodies/source/filter.vcl/egif/dlgegif.cxx
new file mode 100644
index 000000000000..db3ea2d61fd6
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/dlgegif.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgegif.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+#include
+#include
+#include
+#include "dlgegif.hxx"
+#include "dlgegif.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEGIF::DlgExportEGIF( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_GIF, rPara.pResMgr ) ),
+ aCbxInterlaced ( this, ResId( CBX_INTERLACED ) ),
+ aCbxTranslucent ( this, ResId( CBX_TRANSLUCENT ) ),
+ aGrpMode ( this, ResId( GRP_MODE ) ),
+ aGrpDraw ( this, ResId( GRP_DRAW ) ),
+ aBtnOK ( this, ResId( BTN_OK ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, ResId( BTN_HELP ) ),
+ pConfig ( rPara.pCfg ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ String aInterlaceStr( ResId( KEY_INTER, pMgr ) );
+ String aTranslucentStr( ResId( KEY_TRANS, pMgr ) );
+ // Config-Parameter lesen
+ BOOL bInterlaced = ( pConfig->ReadKey( ByteString( aInterlaceStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32() != 0 );
+ BOOL bTranslucent = ( (char) pConfig->ReadKey( ByteString( aTranslucentStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32() != 0 );
+
+ aCbxInterlaced.Check( bInterlaced );
+ aCbxTranslucent.Check( bTranslucent );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEGIF, OK ) );
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEGIF, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+ String aInterlaceStr( ResId( KEY_INTER, pMgr ) );
+ String aTranslucentStr( ResId( KEY_TRANS, pMgr ) );
+
+ ByteString aStr;
+
+ if ( aCbxInterlaced.IsChecked() )
+ aStr = '1';
+ else
+ aStr = '0';
+
+ pConfig->WriteKey( ByteString( aInterlaceStr, RTL_TEXTENCODING_UTF8 ), aStr );
+
+ if ( aCbxTranslucent.IsChecked() )
+ aStr = '1';
+ else
+ aStr = '0';
+
+ pConfig->WriteKey( ByteString( aTranslucentStr, RTL_TEXTENCODING_UTF8 ), aStr );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+
+
diff --git a/goodies/source/filter.vcl/egif/dlgegif.hrc b/goodies/source/filter.vcl/egif/dlgegif.hrc
new file mode 100644
index 000000000000..8ae49d512f5b
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/dlgegif.hrc
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgegif.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "goodies.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define FI_DESCR 1
+#define GRP_MODE 1
+#define GRP_DRAW 2
+#define CBX_INTERLACED 1
+#define CBX_TRANSLUCENT 2
diff --git a/goodies/source/filter.vcl/egif/dlgegif.hxx b/goodies/source/filter.vcl/egif/dlgegif.hxx
new file mode 100644
index 000000000000..41a16506f48a
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/dlgegif.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgegif.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _DLGEGIF_HXX_
+#define _DLGEGIF_HXX_
+
+#include
+#include
+#include
+#include
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class Config;
+class ResMgr;
+
+class DlgExportEGIF : public ModalDialog
+{
+private:
+ CheckBox aCbxInterlaced;
+ CheckBox aCbxTranslucent;
+ GroupBox aGrpMode;
+ GroupBox aGrpDraw;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEGIF( FltCallDialogParameter& rPara );
+};
+
+#endif // _DLGEGIF_HXX_
+
diff --git a/goodies/source/filter.vcl/egif/dlgegif.src b/goodies/source/filter.vcl/egif/dlgegif.src
new file mode 100644
index 000000000000..f88c4a619d61
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/dlgegif.src
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgegif.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "dlgegif.hrc"
+ModalDialog DLG_EXPORT_GIF
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 169 , 70 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text = "GIF Optionen" ;
+ Text [ ENGLISH ] = "GIF options" ;
+ Text [ english_us ] = "GIF Options" ;
+ Text [ italian ] = "Opzioni GIF" ;
+ Text [ spanish ] = "Opciones GIF" ;
+ Text [ french ] = "Options GIF" ;
+ Text [ dutch ] = "GIF-opties" ;
+ Text [ swedish ] = "GIF alternativ" ;
+ Text [ danish ] = "GIF indstillinger" ;
+ Text [ portuguese_brazilian ] = "GIF Optionen" ;
+ Text [ portuguese ] = "Opções GIF" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 113 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 113 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 113 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ GroupBox GRP_MODE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 100 , 29 ) ;
+ 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_brazilian ] = "Modus" ;
+ Text [ portuguese ] = "Modo" ;
+ Text[ chinese_simplified ] = "ģʽ";
+ Text[ russian ] = "Ðåæèì";
+ Text[ polish ] = "Tryb";
+ Text[ japanese ] = "Ó°ÄÞ";
+ Text[ chinese_traditional ] = "¼Ò¦¡";
+ Text[ arabic ] = "æÖÚ";
+ Text[ dutch ] = "Modus";
+ Text[ chinese_simplified ] = "ģʽ";
+ Text[ greek ] = "ÊáôÜóôáóç";
+ Text[ korean ] = "¸ðµå";
+ Text[ turkish ] = "Kip";
+ Text[ language_user1 ] = " ";
+ };
+ CheckBox CBX_INTERLACED
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 86 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "~Interlaced" ;
+ Text [ ENGLISH ] = "~Interlaced" ;
+ Text [ english_us ] = "~Interlaced" ;
+ Text [ portuguese_brazilian ] = "~Interlaced" ;
+ Text [ swedish ] = "~Interlaced" ;
+ Text [ danish ] = "~Interlaced" ;
+ Text [ italian ] = "Interlaced" ;
+ Text [ spanish ] = "~Entrelazado" ;
+ Text [ french ] = "~Entrelacé" ;
+ Text [ dutch ] = "~Interlaced" ;
+ Text [ portuguese ] = "~Interlaced" ;
+ Text[ chinese_simplified ] = "½»´í(~I)";
+ Text[ russian ] = "~Ñ ÷åðåäîâàíèåì";
+ Text[ polish ] = "Interlaced";
+ Text[ japanese ] = "²ÝÀ°Ú°½‚µ‚½(~I)";
+ Text[ chinese_traditional ] = "¥æ¿ù(~I)";
+ Text[ arabic ] = "ãÊÔÇÈß";
+ Text[ dutch ] = "~Interlaced";
+ Text[ chinese_simplified ] = "½»´í(~I)";
+ Text[ greek ] = "ÐåðëåãìÝíç";
+ Text[ korean ] = "ÀÎÅÍ·¹À̽º(~I)";
+ Text[ turkish ] = "~Interlaced";
+ Text[ language_user1 ] = " ";
+ };
+ GroupBox GRP_DRAW
+ {
+ Pos = MAP_APPFONT ( 6 , 35 ) ;
+ Size = MAP_APPFONT ( 100 , 29 ) ;
+ Text = "Zeichenobjekte" ;
+ Text [ ENGLISH ] = "Drawing objects" ;
+ Text [ english_us ] = "Drawing objects" ;
+ Text [ portuguese_brazilian ] = "Zeichenobjekte" ;
+ Text [ swedish ] = "Ritobjekt" ;
+ Text [ danish ] = "Tegneobjekter" ;
+ Text [ italian ] = "Oggetti di disegno" ;
+ Text [ spanish ] = "Objetos de dibujo" ;
+ Text [ french ] = "Objets de dessin" ;
+ Text [ dutch ] = "Tekenobjecten" ;
+ Text [ portuguese ] = "Objectos de desenho" ;
+ Text[ chinese_simplified ] = "»æͼ¶ÔÏó";
+ Text[ russian ] = "Ãðàôè÷åñêèå îáúåêòû";
+ Text[ polish ] = "Obiekty graficzne";
+ Text[ japanese ] = "}Œ`•`‰æµÌÞ¼Þª¸Ä";
+ Text[ russian ] = "Ãðàôè÷åñêèå îáúåêòû";
+ Text[ polish ] = "Obiekty graficzne";
+ Text[ japanese ] = "}Œ`•`‰æµÌÞ¼Þª¸Ä";
+ Text[ chinese_simplified ] = "»æͼ¶ÔÏó";
+ Text[ chinese_traditional ] = "¦r«¬ª«¥ó";
+ Text[ arabic ] = "ßÇÆäÇÊ ÑÓæãíÉ";
+ Text[ dutch ] = "Tekenobjecten";
+ Text[ chinese_simplified ] = "»æͼ¶ÔÏó";
+ Text[ greek ] = "Áíôéêåßìåíá ó÷åäßáóçò";
+ Text[ korean ] = "±×¸®±â °³Ã¼";
+ Text[ turkish ] = "Çizimler";
+ Text[ language_user1 ] = " ";
+ };
+ CheckBox CBX_TRANSLUCENT
+ {
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 86 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "~Transparent speichern" ;
+ Text [ ENGLISH ] = "Save ~transparent" ;
+ Text [ english_us ] = "Save ~transparency" ;
+ Text [ portuguese_brazilian ] = "~Transparent speichern" ;
+ Text [ swedish ] = "Spara ~transparent" ;
+ Text [ danish ] = "Gem ~transparent" ;
+ Text [ italian ] = "Salva in modo trasparente" ;
+ Text [ spanish ] = "Guardar en modo ~transparente" ;
+ Text [ french ] = "Enregistrer en t~ransparence" ;
+ Text [ dutch ] = "~Transparant opslaan" ;
+ Text [ portuguese ] = "~Guardar em modo transparente" ;
+ Text[ chinese_simplified ] = "´æÅÌ͸Ã÷(~T)";
+ Text[ russian ] = "Ñîõðàíèòü â ïðîçðà÷íîì ðåæèìå";
+ Text[ polish ] = "Zapisz w trybie przezroczystym";
+ Text[ japanese ] = "“§‰ß«‚Ì‚Ü‚Ü•Û‘¶(~T)";
+ Text[ chinese_traditional ] = "Àx¦s³z©ú(~T)";
+ Text[ arabic ] = "ÍÝÙ ÔÝÇÝ";
+ Text[ dutch ] = "~Transparant opslaan";
+ Text[ chinese_simplified ] = "´æÅÌ͸Ã÷(~T)";
+ Text[ greek ] = "Äéá~öáíÝò áðïèÞêåõóç";
+ Text[ korean ] = "Åõ¸í ¸ðµå ÀúÀå(~T)";
+ Text[ turkish ] = "Saydam biçimde kaydet";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ chinese_simplified ] = "GIF Ñ¡Ïî";
+ Text[ russian ] = "Ïàðàìåòðû GIF";
+ Text[ polish ] = "Opcje GIF";
+ Text[ japanese ] = "GIF µÌß¼®Ý";
+ Text[ chinese_traditional ] = "GIF¿ï¶µ";
+ Text[ arabic ] = "GIF ÎíÇÑÇÊ";
+ Text[ dutch ] = "GIF-opties";
+ Text[ chinese_simplified ] = "GIF Ñ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò GIF";
+ Text[ korean ] = "GIF ¿É¼Ç";
+ Text[ turkish ] = "GIF seçenekleri";
+ Text[ language_user1 ] = " ";
+};
diff --git a/goodies/source/filter.vcl/egif/egif.cxx b/goodies/source/filter.vcl/egif/egif.cxx
new file mode 100644
index 000000000000..545e158e41b2
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/egif.cxx
@@ -0,0 +1,653 @@
+/*************************************************************************
+ *
+ * $RCSfile: egif.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+#include
+#include
+#include
+#include
+#include "giflzwc.hxx"
+#include "strings.hrc"
+#include "dlgegif.hrc"
+#include "dlgegif.hxx"
+
+// -------------
+// - GIFWriter -
+// -------------
+
+class GIFWriter
+{
+ Bitmap aAccBmp;
+ PFilterCallback pCallback;
+ void* pCallerData;
+ BitmapReadAccess* pAcc;
+ SvStream* pGIF;
+ ULONG nMinPercent;
+ ULONG nMaxPercent;
+ ULONG nLastPercent;
+ long nActX;
+ long nActY;
+ sal_Int32 nInterlaced;
+ BOOL bStatus;
+ BOOL bTransparent;
+
+ void MayCallback( ULONG nPercent );
+ void WriteSignature( BOOL bGIF89a );
+ void WriteGlobalHeader( const Size& rSize );
+ void WriteLoopExtension( const Animation& rAnimation );
+ void WriteLogSizeExtension( const Size& rSize100 );
+ void WriteImageExtension( long nTimer, Disposal eDisposal );
+ void WriteLocalHeader();
+ void WritePalette();
+ void WriteAccess();
+ void WriteTerminator();
+
+ BOOL CreateAccess( const BitmapEx& rBmpEx );
+ void DestroyAccess();
+
+ void WriteAnimation( const Animation& rAnimation );
+ void WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint, BOOL bExtended,
+ long nTimer = 0, Disposal eDisposal = DISPOSE_NOT );
+
+public:
+
+ GIFWriter() {}
+ ~GIFWriter() {}
+
+ BOOL WriteGIF( const Graphic& rGraphic, SvStream& rGIF,
+ PFilterCallback pcallback, void* pcallerdata,
+ Config* pOptionsConfig );
+};
+
+// ------------------------------------------------------------------------
+
+BOOL GIFWriter::WriteGIF( const Graphic& rGraphic, SvStream& rGIF,
+ PFilterCallback pcallback, void* pcallerdata,
+ Config* pOptionsConfig )
+{
+ Size aSize100;
+ const MapMode aMap( rGraphic.GetPrefMapMode() );
+ BOOL bLogSize = ( aMap.GetMapUnit() != MAP_PIXEL );
+
+ if( bLogSize )
+ aSize100 = Application::GetDefaultDevice()->LogicToLogic( rGraphic.GetPrefSize(), aMap, MAP_100TH_MM );
+
+ pGIF = &rGIF;
+ bStatus = TRUE;
+ nLastPercent = 0;
+ nInterlaced = 0;
+ pAcc = NULL;
+ pCallback = pcallback;
+ pCallerData = pcallerdata;
+
+ if ( pOptionsConfig )
+ nInterlaced = pOptionsConfig->ReadKey( "GIF-EXPORT-INTERLACED", "0" ).ToInt32();
+
+ pGIF->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ if( rGraphic.IsAnimated() )
+ {
+ const Animation& rAnimation = rGraphic.GetAnimation();
+
+ WriteSignature( TRUE );
+
+ if ( bStatus )
+ {
+ WriteGlobalHeader( rAnimation.GetDisplaySizePixel() );
+
+ if( bStatus )
+ {
+ WriteLoopExtension( rAnimation );
+
+ if( bStatus )
+ WriteAnimation( rAnimation );
+ }
+ }
+ }
+ else
+ {
+ const BOOL bGrafTrans = rGraphic.IsTransparent();
+
+ BitmapEx aBmpEx;
+
+ if( bGrafTrans )
+ aBmpEx = rGraphic.GetBitmapEx();
+ else
+ aBmpEx = BitmapEx( rGraphic.GetBitmap() );
+
+ nMinPercent = 0;
+ nMaxPercent = 100;
+
+ WriteSignature( bGrafTrans || bLogSize );
+
+ if( bStatus )
+ {
+ WriteGlobalHeader( aBmpEx.GetSizePixel() );
+
+ if( bStatus )
+ WriteBitmapEx( aBmpEx, Point(), bGrafTrans );
+ }
+ }
+
+ if( bStatus )
+ {
+ if( bLogSize )
+ WriteLogSizeExtension( aSize100 );
+
+ WriteTerminator();
+ }
+
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteBitmapEx( const BitmapEx& rBmpEx, const Point& rPoint,
+ BOOL bExtended, long nTimer, Disposal eDisposal )
+{
+ if( CreateAccess( rBmpEx ) )
+ {
+ nActX = rPoint.X();
+ nActY = rPoint.Y();
+
+ if( bExtended )
+ WriteImageExtension( nTimer, eDisposal );
+
+ if( bStatus )
+ {
+ WriteLocalHeader();
+
+ if( bStatus )
+ {
+ WritePalette();
+
+ if( bStatus )
+ WriteAccess();
+ }
+ }
+
+ DestroyAccess();
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteAnimation( const Animation& rAnimation )
+{
+ const USHORT nCount = rAnimation.Count();
+
+ if( nCount )
+ {
+ const double fStep = 100. / nCount;
+
+ nMinPercent = 0L;
+ nMaxPercent = (ULONG) fStep;
+
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ const AnimationBitmap& rAnimBmp = rAnimation.Get( i );
+
+ WriteBitmapEx( rAnimBmp.aBmpEx, rAnimBmp.aPosPix, TRUE,
+ rAnimBmp.nWait, rAnimBmp.eDisposal );
+ nMinPercent = nMaxPercent;
+ nMaxPercent = (ULONG) ( nMaxPercent + fStep );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::MayCallback( ULONG nPercent )
+{
+ if( nPercent >= nLastPercent + 3 )
+ {
+ nLastPercent = nPercent;
+
+ if( pCallback && ( nPercent <= 100 ) && bStatus )
+ if ( ( (*pCallback)( pCallerData, (USHORT) nPercent ) ) )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFWriter::CreateAccess( const BitmapEx& rBmpEx )
+{
+ if( bStatus )
+ {
+ Bitmap aMask( rBmpEx.GetMask() );
+
+ aAccBmp = rBmpEx.GetBitmap();
+ bTransparent = FALSE;
+
+ if( !!aMask )
+ {
+ if( aAccBmp.Convert( BMP_CONVERSION_8BIT_TRANS ) )
+ {
+ aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+ aAccBmp.Replace( aMask, BMP_COL_TRANS );
+ bTransparent = TRUE;
+ }
+ else
+ aAccBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ }
+ else
+ aAccBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+
+ pAcc = aAccBmp.AcquireReadAccess();
+
+ if( !pAcc )
+ bStatus = FALSE;
+ }
+
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::DestroyAccess()
+{
+ aAccBmp.ReleaseAccess( pAcc );
+ pAcc = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteSignature( BOOL bGIF89a )
+{
+ if( bStatus )
+ {
+ pGIF->Write( bGIF89a ? "GIF89a" : "GIF87a" , 6 );
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteGlobalHeader( const Size& rSize )
+{
+ if( bStatus )
+ {
+ // 256 Farben
+ const UINT16 nWidth = (UINT16) rSize.Width();
+ const UINT16 nHeight = (UINT16) rSize.Height();
+ const UINT16 nDummy = 0;
+ const BYTE cFlags = 128 | ( 7 << 4 );
+
+ // Werte rausschreiben
+ *pGIF << nWidth;
+ *pGIF << nHeight;
+ *pGIF << cFlags;
+ *pGIF << (BYTE) 0x00;
+ *pGIF << (BYTE) 0x00;
+
+ // Dummy-Palette mit zwei Eintraegen (Schwarz/Weiss) schreiben;
+ // dieses nur wegen Photoshop-Bug, da die keine Bilder ohne
+ // globale Farbpalette lesen koennen
+ *pGIF << (UINT16) 0;
+ *pGIF << (UINT16) 255;
+ *pGIF << (UINT16) 65535;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteLoopExtension( const Animation& rAnimation )
+{
+ DBG_ASSERT( rAnimation.Count() > 0, "Animation has no bitmaps!" );
+
+ USHORT nLoopCount = (USHORT) rAnimation.GetLoopCount();
+
+ // falls nur ein Durchlauf stattfinden soll,
+ // wird keine LoopExtension geschrieben;
+ // Default ist dann immer ein Durchlauf
+ if( nLoopCount != 1 )
+ {
+ // Netscape interpretiert den LoopCount
+ // als reine Anzahl der _Wiederholungen_
+ if( nLoopCount )
+ nLoopCount--;
+
+ const BYTE cLoByte = (const BYTE) nLoopCount;
+ const BYTE cHiByte = (const BYTE) ( nLoopCount >> 8 );
+
+ *pGIF << (BYTE) 0x21;
+ *pGIF << (BYTE) 0xff;
+ *pGIF << (BYTE) 0x0b;
+ pGIF->Write( "NETSCAPE2.0", 11 );
+ *pGIF << (BYTE) 0x03;
+ *pGIF << (BYTE) 0x01;
+ *pGIF << cLoByte;
+ *pGIF << cHiByte;
+ *pGIF << (BYTE) 0x00;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteLogSizeExtension( const Size& rSize100 )
+{
+ // PrefSize in 100th-mm als ApplicationExtension schreiben
+ if( rSize100.Width() && rSize100.Height() )
+ {
+ *pGIF << (BYTE) 0x21;
+ *pGIF << (BYTE) 0xff;
+ *pGIF << (BYTE) 0x0b;
+ pGIF->Write( "STARDIV 5.0", 11 );
+ *pGIF << (BYTE) 0x09;
+ *pGIF << (BYTE) 0x01;
+ *pGIF << (UINT32) rSize100.Width();
+ *pGIF << (UINT32) rSize100.Height();
+ *pGIF << (BYTE) 0x00;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteImageExtension( long nTimer, Disposal eDisposal )
+{
+ if( bStatus )
+ {
+ const UINT16 nDelay = (UINT16) nTimer;
+ BYTE cFlags = 0;
+
+ // Transparent-Flag setzen
+ if( bTransparent )
+ cFlags |= 1;
+
+ // Disposal-Wert setzen
+ if( eDisposal == DISPOSE_BACK )
+ cFlags |= ( 2 << 2 );
+ else if( eDisposal == DISPOSE_PREVIOUS )
+ cFlags |= ( 3 << 2 );
+
+ *pGIF << (BYTE) 0x21;
+ *pGIF << (BYTE) 0xf9;
+ *pGIF << (BYTE) 0x04;
+ *pGIF << cFlags;
+ *pGIF << nDelay;
+ *pGIF << (BYTE) pAcc->GetBestPaletteIndex( BMP_COL_TRANS );
+ *pGIF << (BYTE) 0x00;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteLocalHeader()
+{
+ if( bStatus )
+ {
+ const UINT16 nPosX = (UINT16) nActX;
+ const UINT16 nPosY = (UINT16) nActY;
+ const UINT16 nWidth = (UINT16) pAcc->Width();
+ const UINT16 nHeight = (UINT16) pAcc->Height();
+ BYTE cFlags = (BYTE) ( pAcc->GetBitCount() - 1 );
+
+ // Interlaced-Flag setzen
+ if( nInterlaced )
+ cFlags |= 0x40;
+
+ // Flag fuer lokale Farbpalette setzen
+ cFlags |= 0x80;
+
+ // alles rausschreiben
+ *pGIF << (BYTE) 0x2c;
+ *pGIF << nPosX;
+ *pGIF << nPosY;
+ *pGIF << nWidth;
+ *pGIF << nHeight;
+ *pGIF << cFlags;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WritePalette()
+{
+ if( bStatus && pAcc->HasPalette() )
+ {
+ const USHORT nCount = pAcc->GetPaletteEntryCount();
+ const USHORT nMaxCount = ( 1 << pAcc->GetBitCount() );
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ const BitmapColor& rColor = pAcc->GetPaletteColor( i );
+
+ *pGIF << rColor.GetRed();
+ *pGIF << rColor.GetGreen();
+ *pGIF << rColor.GetBlue();
+ }
+
+ // Rest mit 0 auffuellen
+ if( nCount < nMaxCount )
+ pGIF->SeekRel( ( nMaxCount - nCount ) * 3 );
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteAccess()
+{
+ GIFLZWCompressor aCompressor;
+ const long nWidth = pAcc->Width();
+ const long nHeight = pAcc->Height();
+ BYTE* pBuffer = NULL;
+ const ULONG nFormat = pAcc->GetScanlineFormat();
+ long nY;
+ long nT;
+ long i;
+ BOOL bNative = ( BMP_FORMAT_8BIT_PAL == nFormat );
+
+ if( !bNative )
+ pBuffer = new BYTE[ nWidth ];
+
+ if( bStatus && ( 8 == pAcc->GetBitCount() ) && pAcc->HasPalette() )
+ {
+ aCompressor.StartCompression( *pGIF, pAcc->GetBitCount() );
+
+ for( i = 0; i < nHeight; i++ )
+ {
+ if( nInterlaced )
+ {
+ nY = i << 3;
+
+ if( nY >= nHeight )
+ {
+ nT = i - ( ( nHeight + 7 ) >> 3 );
+ nY= ( nT << 3 ) + 4;
+
+ if( nY >= nHeight )
+ {
+ nT -= ( nHeight + 3 ) >> 3;
+ nY = ( nT << 2 ) + 2;
+
+ if ( nY >= nHeight )
+ {
+ nT -= ( ( nHeight + 1 ) >> 2 );
+ nY = ( nT << 1 ) + 1;
+ }
+ }
+ }
+ }
+ else
+ nY = i;
+
+ if( bNative )
+ aCompressor.Compress( pAcc->GetScanline( nY ), nWidth );
+ else
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pBuffer[ nX ] = (BYTE) pAcc->GetPixel( nY, nX );
+
+ aCompressor.Compress( pBuffer, nWidth );
+ }
+
+ if ( pGIF->GetError() )
+ bStatus = FALSE;
+
+ MayCallback( nMinPercent + ( nMaxPercent - nMinPercent ) * i / nHeight );
+
+ if( !bStatus )
+ break;
+ }
+
+ aCompressor.EndCompression();
+
+ if ( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+
+ delete[] pBuffer;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFWriter::WriteTerminator()
+{
+ if( bStatus )
+ {
+ *pGIF << (BYTE) 0x3b;
+
+ if( pGIF->GetError() )
+ bStatus = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig, BOOL )
+{
+ return GIFWriter().WriteGIF( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow && rPara.pCfg )
+ {
+ ByteString aResMgrName( "egi" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEGIF( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+#pragma hdrstop
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/egif/egifstr.src b/goodies/source/filter.vcl/egif/egifstr.src
new file mode 100644
index 000000000000..e3fc4e4fa59b
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/egifstr.src
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: egifstr.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_INTER
+{
+ Text = "GIF-EXPORT-INTERLACED";
+};
+String KEY_TRANS
+{
+ Text = "GIF-EXPORT-TRANSLUCENT";
+};
diff --git a/goodies/source/filter.vcl/egif/giflzwc.cxx b/goodies/source/filter.vcl/egif/giflzwc.cxx
new file mode 100644
index 000000000000..29c3a7735d27
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/giflzwc.cxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * $RCSfile: giflzwc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include "giflzwc.hxx"
+
+// ----------------------------
+// - GIFImageDataOutputStream -
+// ----------------------------
+
+class GIFImageDataOutputStream
+{
+private:
+
+ void FlushBlockBuf();
+ inline void FlushBitsBufsFullBytes();
+
+ SvStream& rStream;
+ BYTE* pBlockBuf;
+ BYTE nBlockBufSize;
+ ULONG nBitsBuf;
+ USHORT nBitsBufSize;
+
+public:
+
+ GIFImageDataOutputStream( SvStream & rGIF, BYTE nLZWDataSize );
+ ~GIFImageDataOutputStream();
+
+ inline void WriteBits( USHORT nCode, USHORT nCodeLen );
+};
+
+// ------------------------------------------------------------------------
+
+inline void GIFImageDataOutputStream::FlushBitsBufsFullBytes()
+{
+ while (nBitsBufSize>=8)
+ {
+ if( nBlockBufSize==255 )
+ FlushBlockBuf();
+
+ pBlockBuf[nBlockBufSize++] = (BYTE) nBitsBuf;
+ nBitsBuf >>= 8;
+ nBitsBufSize -= 8;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+inline void GIFImageDataOutputStream::WriteBits( USHORT nCode, USHORT nCodeLen )
+{
+ if( nBitsBufSize+nCodeLen>32 )
+ FlushBitsBufsFullBytes();
+
+ nBitsBuf |= (ULONG) nCode << nBitsBufSize;
+ nBitsBufSize += nCodeLen;
+}
+
+// ------------------------------------------------------------------------
+
+GIFImageDataOutputStream::GIFImageDataOutputStream( SvStream & rGIF, BYTE nLZWDataSize ) :
+ rStream(rGIF)
+{
+ pBlockBuf = new BYTE[ 255 ];
+ nBlockBufSize = 0;
+ nBitsBufSize = 0;
+ nBitsBuf = 0;
+ rStream << nLZWDataSize;
+}
+
+// ------------------------------------------------------------------------
+
+
+GIFImageDataOutputStream::~GIFImageDataOutputStream()
+{
+ WriteBits(0,7);
+ FlushBitsBufsFullBytes();
+ FlushBlockBuf();
+ rStream << (BYTE)0;
+ delete[] pBlockBuf;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFImageDataOutputStream::FlushBlockBuf()
+{
+ if( nBlockBufSize )
+ {
+ rStream << (BYTE) nBlockBufSize;
+ rStream.Write( pBlockBuf,nBlockBufSize );
+ nBlockBufSize = 0;
+ }
+}
+
+// -------------------
+// - GIFLZWCTreeNode -
+// -------------------
+
+struct GIFLZWCTreeNode
+{
+
+ GIFLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat
+ GIFLZWCTreeNode* pFirstChild; // erster Sohn
+ USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn
+ USHORT nValue; // Der Pixelwert
+};
+
+// --------------------
+// - GIFLZWCompressor -
+// --------------------
+
+GIFLZWCompressor::GIFLZWCompressor()
+{
+ pIDOS=NULL;
+}
+
+// ------------------------------------------------------------------------
+
+GIFLZWCompressor::~GIFLZWCompressor()
+{
+ if (pIDOS!=NULL) EndCompression();
+}
+
+// ------------------------------------------------------------------------
+
+void GIFLZWCompressor::StartCompression( SvStream& rGIF, USHORT nPixelSize )
+{
+ if( !pIDOS )
+ {
+ USHORT i;
+
+ nDataSize = nPixelSize;
+
+ if( nDataSize < 2 )
+ nDataSize=2;
+
+ nClearCode=1<WriteBits( nClearCode,nCodeSize );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFLZWCompressor::Compress( HPBYTE pSrc, ULONG nSize )
+{
+ if( pIDOS )
+ {
+ GIFLZWCTreeNode* p;
+ USHORT i;
+ BYTE nV;
+
+ if( !pPrefix && nSize )
+ {
+ pPrefix=pTable+(*pSrc++);
+ nSize--;
+ }
+
+ while( nSize )
+ {
+ nSize--;
+ nV=*pSrc++;
+ for( p=pPrefix->pFirstChild; p!=NULL; p=p->pBrother )
+ {
+ if (p->nValue==nV)
+ break;
+ }
+
+ if( p)
+ pPrefix=p;
+ else
+ {
+ pIDOS->WriteBits(pPrefix->nCode,nCodeSize);
+
+ if (nTableSize==4096)
+ {
+ pIDOS->WriteBits(nClearCode,nCodeSize);
+
+ for (i=0; ipBrother=pPrefix->pFirstChild;
+ pPrefix->pFirstChild=p;
+ p->nValue=nV;
+ p->pFirstChild=NULL;
+ }
+
+ pPrefix=pTable+nV;
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFLZWCompressor::EndCompression()
+{
+ if( pIDOS )
+ {
+ if( pPrefix )
+ pIDOS->WriteBits(pPrefix->nCode,nCodeSize);
+
+ pIDOS->WriteBits( nEOICode,nCodeSize );
+ delete[] pTable;
+ delete pIDOS;
+ pIDOS=NULL;
+ }
+}
diff --git a/goodies/source/filter.vcl/egif/giflzwc.hxx b/goodies/source/filter.vcl/egif/giflzwc.hxx
new file mode 100644
index 000000000000..9f92644265e9
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/giflzwc.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * $RCSfile: giflzwc.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _GIFLZWC_HXX
+#define _GIFLZWC_HXX
+
+#ifndef _BMPACC_HXX
+#include
+#endif
+
+// --------------------
+// - GIFLZWCompressor -
+// --------------------
+
+class GIFImageDataOutputStream;
+struct GIFLZWCTreeNode;
+
+class GIFLZWCompressor
+{
+private:
+
+ GIFImageDataOutputStream* pIDOS;
+ GIFLZWCTreeNode* pTable;
+ GIFLZWCTreeNode* pPrefix;
+ USHORT nDataSize;
+ USHORT nClearCode;
+ USHORT nEOICode;
+ USHORT nTableSize;
+ USHORT nCodeSize;
+
+public:
+
+ GIFLZWCompressor();
+ ~GIFLZWCompressor();
+
+ void StartCompression( SvStream& rGIF, USHORT nPixelSize );
+ void Compress( HPBYTE pSrc, ULONG nSize );
+ void EndCompression();
+};
+
+#endif // _GIFLZWC_HXX
diff --git a/goodies/source/filter.vcl/egif/makefile.mk b/goodies/source/filter.vcl/egif/makefile.mk
new file mode 100644
index 000000000000..7bb41384300a
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/makefile.mk
@@ -0,0 +1,188 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=VCL
+TARGET=egif
+TARGET2=egi
+DEPTARGET=vegif
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+# --- Settings -----------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# --- Files --------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRCFILES = dlgegif.src \
+ egifstr.src
+
+SLOFILES= $(SLO)$/egif.obj \
+ $(SLO)$/dlgegif.obj \
+ $(SLO)$/giflzwc.obj
+
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=\
+ $(SRS)$/$(TARGET).srs
+
+SHL1TARGET= egi$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= egif
+SHL1STDLIBS= \
+ $(TOOLSLIB) \
+ $(SVLIB) \
+ $(CPPULIB) \
+ $(SVTOOLLIB)
+
+SHL1DEPN= $(LB)$/egif.lib
+SHL1LIBS= $(SLB)$/egif.lib # $(LB)$/rtftoken.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/egif.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+ @echo _DoExportDialog >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET) >>$@
+ @echo GraphicExport_ >>temp.def
+ @echo DoExportDialog_ >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/egif/strings.hrc b/goodies/source/filter.vcl/egif/strings.hrc
new file mode 100644
index 000000000000..d09d02ec9582
--- /dev/null
+++ b/goodies/source/filter.vcl/egif/strings.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define KEY_INTER 256
+#define KEY_TRANS 257
diff --git a/goodies/source/filter.vcl/eos2met/dlgeos2.cxx b/goodies/source/filter.vcl/eos2met/dlgeos2.cxx
new file mode 100644
index 000000000000..7c5726c761ab
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/dlgeos2.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeos2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include
+#include
+#include "dlgeos2.hxx"
+#include "dlgeos2.hrc"
+#include "strings.hrc"
+
+#include
+
+SEG_EOFGLOBALS()
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEMET::DlgExportEMET( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EMET, rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, ResId( BTN_HELP ) ),
+ aRbOriginal ( this, ResId( RB_ORIGINAL ) ),
+ aRbSize ( this, ResId( RB_SIZE ) ),
+ aGrpMode ( this, ResId( GRP_MODE ) ),
+ aFtSizeX ( this, ResId( FT_SIZEX ) ),
+ aMtfSizeX ( this, ResId( MTF_SIZEX ) ),
+ aFtSizeY ( this, ResId( FT_SIZEY ) ),
+ aMtfSizeY ( this, ResId( MTF_SIZEY ) ),
+ aGrpSize ( this, ResId( GRP_SIZE ) ),
+ pConfig ( rPara.pCfg ),
+ pMgr ( rPara.pResMgr )
+
+{
+ FreeResource();
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEMET, OK ) );
+ aRbOriginal.SetClickHdl( LINK( this, DlgExportEMET, ClickRbOriginal ) );
+ aRbSize.SetClickHdl( LINK( this, DlgExportEMET, ClickRbSize ) );
+
+ // Config-Parameter lesen
+ String aModeStr( ResId( KEY_MODE, pMgr ) );
+ String aSizeXStr( ResId( KEY_SIZEX, pMgr ) );
+ String aSizeYStr( ResId( KEY_SIZEY, pMgr ) );
+ ByteString aStrMode( pConfig->ReadKey( ByteString( aModeStr, RTL_TEXTENCODING_UTF8 ) ) );
+ ByteString aStrSizeX( pConfig->ReadKey( ByteString( aSizeXStr, RTL_TEXTENCODING_UTF8 ) ) );
+ ByteString aStrSizeY( pConfig->ReadKey( ByteString( aSizeYStr, 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;
+ }
+
+ if ( aStrMode.Len() && ( aStrMode.GetChar( 0 ) == '1' ) )
+ {
+ aRbSize.Check( TRUE );
+ ClickRbSize( NULL );
+ }
+ else
+ {
+ aRbOriginal.Check( TRUE );
+ ClickRbOriginal( NULL );
+ }
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEMET, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ sal_Int32 nSizeX = (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM );
+ sal_Int32 nSizeY = (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM );
+ sal_Int32 nStrMode = ( aRbSize.IsChecked() ) ? 1 : 0;
+
+ String aModeStr( ResId( KEY_MODE, pMgr ) );
+ String aSizeXStr( ResId( KEY_SIZEX, pMgr ) );
+ String aSizeYStr( ResId( KEY_SIZEY, pMgr ) );
+ pConfig->WriteKey( ByteString( aModeStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nStrMode ) );
+ pConfig->WriteKey( ByteString( aSizeXStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nSizeX ) );
+ pConfig->WriteKey( ByteString( aSizeYStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nSizeY ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEMET, ClickRbOriginal, void*, EMPTYARG )
+{
+ aGrpSize.Disable();
+ aFtSizeX.Disable();
+ aMtfSizeX.Disable();
+ aFtSizeY.Disable();
+ aMtfSizeY.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+#pragma SEG_FUNCDEF(dlgeos2_09)
+
+IMPL_LINK( DlgExportEMET, ClickRbSize, void*, EMPTYARG )
+{
+ aGrpSize.Enable();
+ aFtSizeX.Enable();
+ aMtfSizeX.Enable();
+ aFtSizeY.Enable();
+ aMtfSizeY.Enable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+
+ Source Code Control System - History
+
+ $Log: not supported by cvs2svn $
+ Revision 1.6 2000/09/15 15:27:06 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.5 2000/07/26 17:24:45 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.4 2000/04/16 11:17:23 sj
+ #75046# displaying different metrics
+
+ Revision 1.3 2000/04/07 11:31:47 sj
+ unicode changes
+
+ Revision 1.2 1998/01/17 11:56:14 KA
+ Includes
+
+
+ Rev 1.1 17 Jan 1998 12:56:14 KA
+ Includes
+
+ Rev 1.0 26 Aug 1997 11:36:48 KA
+ Initial revision.
+
+ Rev 1.2 06 Feb 1996 12:38:06 KA
+ #25026#: Defaultgroesse fuer Export auf 10*10 cm angehoben
+
+ Rev 1.1 22 Jan 1996 15:25:10 KA
+ Dialoge umgestellt / erweitert
+
+ Rev 1.0 19 Jan 1996 20:09:16 KA
+ Dialoganbindung
+
+*************************************************************************/
+
+#pragma SEG_EOFMODULE
diff --git a/goodies/source/filter.vcl/eos2met/dlgeos2.hrc b/goodies/source/filter.vcl/eos2met/dlgeos2.hrc
new file mode 100644
index 000000000000..6e8ab913e32f
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/dlgeos2.hrc
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeos2.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "goodies.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define CBX_SIZE 2
+#define MTF_SIZEX 1
+#define MTF_SIZEY 2
+#define FT_SIZEX 1
+#define FT_SIZEY 2
+#define GRP_SIZE 1
+#define GRP_MODE 2
+#define RB_ORIGINAL 1
+#define RB_SIZE 2
+
diff --git a/goodies/source/filter.vcl/eos2met/dlgeos2.hxx b/goodies/source/filter.vcl/eos2met/dlgeos2.hxx
new file mode 100644
index 000000000000..c014e50cb6c7
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/dlgeos2.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeos2.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DLGEOS2_HXX_
+#define _DLGEOS2_HXX_
+#include
+#include
+#include
+#include
+#include
+#include
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten
+|*
+\************************************************************************/
+
+class Config;
+class ResMgr;
+
+class DlgExportEMET : 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;
+
+ DECL_LINK( OK, void* p );
+ DECL_LINK( ClickRbOriginal,void* p );
+ DECL_LINK( ClickRbSize,void* p );
+
+public:
+ DlgExportEMET( FltCallDialogParameter& rPara );
+};
+
+
+#endif // _DLGEMET_HXX_
+
diff --git a/goodies/source/filter.vcl/eos2met/dlgeos2.src b/goodies/source/filter.vcl/eos2met/dlgeos2.src
new file mode 100644
index 000000000000..b543fefae4db
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/dlgeos2.src
@@ -0,0 +1,318 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeos2.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "dlgeos2.hrc"
+
+ModalDialog DLG_EXPORT_EMET
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 178 , 98 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text = "MET Optionen" ;
+ Text [ ENGLISH ] = "MET options" ;
+ Text [ english_us ] = "MET Options" ;
+ Text [ italian ] = "Opzioni MET" ;
+ Text [ spanish ] = "Opciones MET" ;
+ Text [ french ] = "Options MET" ;
+ Text [ dutch ] = "MET-opties" ;
+ Text [ swedish ] = "MET alternativ" ;
+ Text [ danish ] = "MET indstillinger" ;
+ Text [ portuguese_brazilian ] = "MET Optionen" ;
+ Text [ portuguese ] = "Opções MET" ;
+ MetricField MTF_SIZEX
+ {
+ 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 110 , 44 ) ;
+ Text = "Größe" ;
+ Text [ ENGLISH ] = "Size" ;
+ Text [ english_us ] = "Size" ;
+ Text [ dutch ] = "Grootte" ;
+ Text [ italian ] = "Dimens." ;
+ Text [ spanish ] = "Tamaño" ;
+ Text [ french ] = "Taille" ;
+ Text [ swedish ] = "Storlek" ;
+ Text [ danish ] = "Størrelse" ;
+ Text [ portuguese ] = "Tamanho" ;
+ Text [ portuguese_brazilian ] = "Tamanho" ;
+ Text[ russian ] = "Ðàçìåð";
+ Text[ polish ] = "Rozmiar";
+ Text[ japanese ] = "»²½Þ";
+ Text[ chinese_simplified ] = "´óС";
+ Text[ chinese_traditional ] = "¤j¤p";
+ Text[ arabic ] = "ÇáÍÌã";
+ Text[ dutch ] = "Grootte";
+ Text[ chinese_simplified ] = "´óС";
+ Text[ greek ] = "ÌÝãåèïò";
+ Text[ korean ] = "Å©±â";
+ Text[ turkish ] = "Boyut";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SIZEX
+ {
+ 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 ] = "Largura" ;
+ Text[ russian ] = "Øèðèíà";
+ Text[ polish ] = "Szer.";
+ Text[ japanese ] = "•";
+ Text[ chinese_simplified ] = "¿í¶È";
+ Text[ chinese_traditional ] = "¼e«×";
+ Text[ arabic ] = "ÇáÚÑÖ";
+ Text[ dutch ] = "Breedte";
+ Text[ chinese_simplified ] = "¿í¶È";
+ Text[ greek ] = "ÐëÜôïò";
+ Text[ korean ] = "³Êºñ";
+ Text[ turkish ] = "Geniþlik";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SIZEY
+ {
+ 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øjde" ;
+ Text [ portuguese ] = "Altura" ;
+ Text[ russian ] = "Âûñîòà";
+ Text[ polish ] = "Wys.";
+ Text[ japanese ] = "‚‚³";
+ Text[ chinese_simplified ] = "¸ß¶È";
+ Text[ chinese_traditional ] = "°ª«×";
+ Text[ arabic ] = "ÇáÇÑÊÝÇÚ";
+ Text[ dutch ] = "Hoogte";
+ Text[ chinese_simplified ] = "¸ß¶È";
+ Text[ greek ] = "¾øïò";
+ Text[ korean ] = "³ôÀÌ";
+ Text[ turkish ] = "Yükseklik";
+ Text[ language_user1 ] = " ";
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 122 , 24 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 122 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( 12 , 12 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "~Original" ;
+ Text [ ENGLISH ] = "~Original" ;
+ 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[ russian ] = "Îðèãèíàë";
+ Text[ polish ] = "Orygina³";
+ Text[ japanese ] = "µØ¼ÞÅÙ(~O)";
+ Text[ chinese_simplified ] = "Ô¼þ(~O)";
+ Text[ chinese_traditional ] = "ì¥ó(~O)";
+ Text[ arabic ] = "ÇáÃÕá";
+ Text[ dutch ] = "~Origineel";
+ Text[ chinese_simplified ] = "Ô¼þ(~O)";
+ Text[ greek ] = "Á~ñ÷éêü";
+ Text[ korean ] = "¿À¸®Áö³Î(~O)";
+ Text[ language_user1 ] = " ";
+ Text[ turkish ] = "Aslý";
+ };
+ RadioButton RB_SIZE
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "~Größe" ;
+ Text [ ENGLISH ] = "~Size" ;
+ Text [ dutch ] = "~Grootte" ;
+ Text [ english_us ] = "~Size" ;
+ Text [ italian ] = "~Dimens." ;
+ Text [ spanish ] = "~Tamaño" ;
+ Text [ french ] = "~Taille" ;
+ Text [ swedish ] = "~Storlek" ;
+ Text [ danish ] = "~Størrelse" ;
+ Text [ portuguese ] = "~Tamanho" ;
+ Text [ portuguese_brazilian ] = "~Tamanho" ;
+ Text[ russian ] = "Ðàçìåð";
+ Text[ polish ] = "Rozmiar";
+ Text[ japanese ] = "»²½Þ(~S)";
+ Text[ chinese_simplified ] = "´óС(~S)";
+ Text[ chinese_traditional ] = "¤j¤p(~S)";
+ Text[ arabic ] = "ÇáÍÌã";
+ Text[ dutch ] = "~Grootte";
+ Text[ chinese_simplified ] = "´óС(~S)";
+ Text[ greek ] = "ÌÝãåèïò";
+ Text[ korean ] = "Å©±â(~S)";
+ Text[ turkish ] = "Boyut";
+ Text[ language_user1 ] = " ";
+ };
+ GroupBox GRP_MODE
+ {
+ 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[ russian ] = "Ðåæèì";
+ Text[ polish ] = "Tryb";
+ Text[ japanese ] = "Ó°ÄÞ";
+ Text[ chinese_simplified ] = "ģʽ";
+ Text[ chinese_traditional ] = "¼Ò¦¡";
+ Text[ arabic ] = "ÇáæÖÚ";
+ Text[ dutch ] = "Modus";
+ Text[ chinese_simplified ] = "ģʽ";
+ Text[ greek ] = "ÊáôÜóôáóç";
+ Text[ korean ] = "¸ðµå";
+ Text[ turkish ] = "Kip";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ russian ] = "Ïàðàìåòðû MET";
+ Text[ polish ] = "Opcje MET";
+ Text[ japanese ] = "MET µÌß¼®Ý";
+ Text[ chinese_simplified ] = "MET Ñ¡Ïî";
+ Text[ chinese_traditional ] = "MET¿ï¶µ";
+ Text[ arabic ] = "MET ÎíÇÑÇÊ";
+ Text[ dutch ] = "MET-opties";
+ Text[ chinese_simplified ] = "MET Ñ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò MET";
+ Text[ korean ] = "MET ¿É¼Ç";
+ Text[ turkish ] = "MET seçenekleri";
+ Text[ language_user1 ] = " ";
+};
diff --git a/goodies/source/filter.vcl/eos2met/eos2met.cxx b/goodies/source/filter.vcl/eos2met/eos2met.cxx
new file mode 100644
index 000000000000..829c8f50d36b
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/eos2met.cxx
@@ -0,0 +1,2667 @@
+/*************************************************************************
+ *
+ * $RCSfile: eos2met.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if SUPD <= 364
+#include
+#include
+#else
+#include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "strings.hrc"
+#include "dlgeos2.hxx"
+
+// -----------------------------Feld-Typen-------------------------------
+
+#define BegDocumnMagic 0xA8A8 /* Begin Document */
+#define EndDocumnMagic 0xA8A9 /* End Document */
+
+#define BegResGrpMagic 0xC6A8 /* Begin Resource Group */
+#define EndResGrpMagic 0xC6A9 /* End Resource Group */
+
+#define BegColAtrMagic 0x77A8 /* Begin Color Attribute Table */
+#define EndColAtrMagic 0x77A9 /* End Color Attribute Table */
+#define BlkColAtrMagic 0x77B0 /* Color Attribute Table */
+#define MapColAtrMagic 0x77AB /* Map Color Attribute Table */
+
+#define BegImgObjMagic 0xFBA8 /* Begin Image Object */
+#define EndImgObjMagic 0xFBA9 /* End Image Object */
+#define DscImgObjMagic 0xFBA6 /* Image Data Descriptor */
+#define DatImgObjMagic 0xFBEE /* Image Picture Data */
+
+#define BegObjEnvMagic 0xC7A8 /* Begin Object Environment Group */
+#define EndObjEnvMagic 0xC7A9 /* End Object Environment Group */
+
+#define BegGrfObjMagic 0xBBA8 /* Begin Graphics Object */
+#define EndGrfObjMagic 0xBBA9 /* End Graphics Object */
+#define DscGrfObjMagic 0xBBA6 /* Graphics Data Descritor */
+#define DatGrfObjMagic 0xBBEE /* Graphics Data */
+
+#define MapCodFntMagic 0x8AAB /* Map Coded Font */
+#define MapDatResMagic 0xC3AB /* Map Data Resource */
+
+// Struktur des Metafiles
+// BegDocumn
+// BegResGrp
+// BegColAtr
+// BlkColAtr
+// EndColAtr
+// BegImgObj[0..n]
+// BegResGrp[]
+// BegColAtr[]
+// BlkColAtr
+// EndColAtr
+// EndResGrp
+// BegObjEnv[]
+// MapColAtr
+// EndObjEnv
+// DscImgObj
+// DatImgOb1
+// DatImgOb2[1..n]
+// EndImgObj
+// BegGrfObj
+// BegObjEnv[]
+// MapColAtr
+// MapCodFnt1
+// MapCodFnt2[0..n]
+// MapDatRes[0..n]
+// EndObjEnv
+// DscGrfObj
+// DatGrfObj[0..n]
+// EndGrfObj
+// EndResGrp
+// EndDocumn
+
+//============================== METWriter ===================================
+
+struct METChrSet
+{
+ struct METChrSet * pSucc;
+ BYTE nSet;
+ ByteString aName;
+ FontWeight eWeight;
+};
+
+struct METGDIStackMember
+{
+ struct METGDIStackMember * pSucc;
+ Color aLineColor;
+ Color aFillColor;
+ RasterOp eRasterOp;
+ Font aFont;
+ MapMode aMapMode;
+ Region aClipRegion;
+};
+
+class METWriter
+{
+private:
+
+ BOOL bStatus;
+ PFilterCallback pCallback;
+ void* pCallerData;
+ ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
+ SvStream* pMET;
+ Rectangle aPictureRect;
+ MapMode aPictureMapMode;
+ MapMode aTargetMapMode;
+ ULONG nActualFieldStartPos; // Anfangs-Position des aktuellen 'Field'
+ ULONG nNumberOfDataFields; // Anzahl der angefangenen 'Graphcis Data Fields'
+ Color aGDILineColor;
+ Color aGDIFillColor;
+ RasterOp eGDIRasterOp;
+ Font aGDIFont;
+ MapMode aGDIMapMode; // derzeit unbenutzt!
+ Region aGDIClipRegion; // derzeit unbenutzt!
+ METGDIStackMember* pGDIStack;
+ Color aMETColor;
+ Color aMETBackgroundColor;
+ Color aMETPatternSymbol;
+ RasterOp eMETMix ;
+ long nMETStrokeLineWidth;
+ Size aMETChrCellSize;
+ short nMETChrAngle;
+ BYTE nMETChrSet;
+ METChrSet* pChrSetList; // Liste der Character-Sets
+ BYTE nNextChrSetId; // die erste unbenutzte ChrSet-Id
+ ULONG nActBitmapId; // Field-Id der naechsten Bitmap
+ 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 * pMTF);
+ // Zaehlt die Bitmaps und Actions (nNumberOfActions und nNumberOfBitmaps muessen
+ // zu Anfang auf 0 gesetzt werden, weil diese Methode rekursiv ist)
+
+ void WriteBigEndianShort(USHORT nWord);
+ void WriteBigEndianLong(ULONG nLong);
+
+ void WritePoint(Point aPt);
+
+ void WriteFieldIntroducer(USHORT nFieldSize, USHORT nFieldType,
+ BYTE nFlags, USHORT nSegSeqNum);
+ void UpdateFieldSize();
+
+ void WriteFieldId(ULONG nId);
+
+ void CreateChrSets(const GDIMetaFile * pMTF);
+ void CreateChrSet(const Font & rFont);
+ void WriteChrSets();
+ BYTE FindChrSet(const Font & rFont);
+
+ void WriteColorAttributeTable(ULONG nFieldId=4, BitmapPalette* pPalette=NULL,
+ BYTE nBasePartFlags=0x40, BYTE nBasePartLCTID=0);
+
+ void WriteImageObject(const Bitmap & rBitmap);
+ void WriteImageObjects(const GDIMetaFile * pMTF);
+
+ void WriteDataDescriptor(const GDIMetaFile * pMTF);
+
+ void WillWriteOrder(ULONG nNextOrderMaximumLength);
+
+ void METSetAndPushLineInfo( const LineInfo& rLineInfo );
+ void METPopLineInfo( const LineInfo& rLineInfo );
+ void METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap);
+ void METBeginArea(BOOL bBoundaryLine);
+ void METEndArea();
+ void METBeginPath(ULONG nPathId);
+ void METEndPath();
+ void METFillPath(ULONG nPathId);
+ void METOutlinePath(ULONG nPathId);
+ void METCloseFigure();
+ void METMove(Point aPt);
+ void METLine(Point aPt1, Point aPt2);
+ void METLine(const Polygon & rPolygon);
+ void METLine(const PolyPolygon & rPolyPolygon);
+ void METLineAtCurPos(Point aPt);
+ void METBox(BOOL bFill, BOOL bBoundary,
+ Rectangle aRect, ULONG nHAxis, ULONG nVAxis);
+ void METArc(Point aP0, Point aP1, Point aP2);
+ void METArcAtCurPos(Point aP1, Point aP2);
+ void METFullArc(Point aCenter, double fMultiplier);
+ void METPartialArcAtCurPos(Point aCenter, double fMultiplier,
+ double fStartAngle, double fSweepAngle);
+ void METChrStr(Point aPt, String aStr);
+ void METSetArcParams(long nP, long nQ, long nR, long nS);
+ void METSetColor(Color aColor);
+ void METSetBackgroundColor(Color aColor);
+ void METSetMix(RasterOp eROP);
+ void METSetChrCellSize(Size aSize);
+ void METSetChrAngle(short nAngle);
+ void METSetChrSet(BYTE nSet);
+
+ void WriteOrders(const GDIMetaFile * pMTF);
+
+ void WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF);
+
+ void WriteGraphicsObject(const GDIMetaFile * pMTF);
+
+ void WriteResourceGroup(const GDIMetaFile * pMTF);
+
+ void WriteDocument(const GDIMetaFile * pMTF);
+
+public:
+
+ METWriter() {}
+
+ BOOL WriteMET(const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ PFilterCallback pcallback, void * pcallerdata);
+};
+
+
+//========================== Methoden von METWriter ==========================
+
+void METWriter::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 METWriter::CountActionsAndBitmaps(const GDIMetaFile * pMTF)
+{
+ const MetaAction* pMA;
+
+ for( ULONG nAction = 0, nCount=pMTF->GetActionCount(); nAction < nCount; nAction++ )
+ {
+ pMA = pMTF->GetAction(nAction);
+
+ switch (pMA->GetType())
+ {
+ case META_EPS_ACTION :
+ {
+ const GDIMetaFile aGDIMetaFile( ((const MetaEPSAction*)pMA)->GetSubstitute() );
+ INT32 nCount = aGDIMetaFile.GetActionCount();
+ INT32 i;
+ for ( i = 0; i < nCount; i++ )
+ if ( ((const MetaAction*)aGDIMetaFile.GetAction( i ))->GetType() == META_BMPSCALE_ACTION )
+ break;
+ if ( i == nCount)
+ break;
+ }
+ 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 METWriter::WriteBigEndianShort(USHORT nWord)
+{
+ *pMET << ((BYTE)(nWord>>8)) << ((BYTE)(nWord&0x00ff));
+}
+
+
+void METWriter::WriteBigEndianLong(ULONG nLong)
+{
+ WriteBigEndianShort((USHORT)(nLong>>16));
+ WriteBigEndianShort((USHORT)(nLong&0x0000ffff));
+}
+
+
+void METWriter::WritePoint(Point aPt)
+{
+ Point aNewPt = OutputDevice::LogicToLogic( aPt, aPictureMapMode, aTargetMapMode );
+
+ *pMET << (long) ( aNewPt.X() - aPictureRect.Left() )
+ << (long) ( aPictureRect.Bottom() - aNewPt.Y() );
+}
+
+
+void METWriter::WriteFieldIntroducer(USHORT nFieldSize, USHORT nFieldType,
+ BYTE nFlags, USHORT nSegSeqNum)
+{
+ nActualFieldStartPos=pMET->Tell();
+ WriteBigEndianShort(nFieldSize);
+ *pMET << (BYTE)0xd3 << nFieldType << nFlags << nSegSeqNum;
+}
+
+
+void METWriter::UpdateFieldSize()
+{
+ ULONG nPos;
+
+ nPos=pMET->Tell();
+ pMET->Seek(nActualFieldStartPos);
+ WriteBigEndianShort((USHORT)(nPos-nActualFieldStartPos));
+ pMET->Seek(nPos);
+}
+
+
+void METWriter::WriteFieldId(ULONG nId)
+{
+ BYTE nbyte;
+ short i;
+
+ for (i=1; i<=8; i++) {
+ nbyte= '0' + (BYTE)((nId >> (32-i*4)) & 0x0f);
+ *pMET << nbyte;
+ }
+}
+
+
+void METWriter::CreateChrSets(const GDIMetaFile * pMTF)
+{
+ ULONG nAction, nActionCount;
+ const MetaAction * pMA;
+
+ if (bStatus==FALSE)
+ return;
+
+ nActionCount=pMTF->GetActionCount();
+
+ for (nAction=0; nActionGetAction(nAction);
+
+ switch (pMA->GetType())
+ {
+ case META_FONT_ACTION:
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pMA;
+ CreateChrSet( pA->GetFont() );
+ }
+ break;
+ }
+ }
+}
+
+
+void METWriter::CreateChrSet(const Font & rFont)
+{
+ METChrSet * pCS;
+
+ if ( FindChrSet( rFont ) == 0 )
+ {
+ pCS = new METChrSet;
+ pCS->pSucc = pChrSetList; pChrSetList=pCS;
+ pCS->nSet = nNextChrSetId++;
+ pCS->aName = ByteString( rFont.GetName(), RTL_TEXTENCODING_UTF8 );
+ pCS->eWeight = rFont.GetWeight();
+ }
+}
+
+
+BYTE METWriter::FindChrSet(const Font & rFont)
+{
+ METChrSet* pCS;
+
+ for (pCS=pChrSetList; pCS!=NULL; pCS=pCS->pSucc)
+ {
+ if (pCS->aName==rFont.GetName() && pCS->eWeight==rFont.GetWeight() )
+ return pCS->nSet;
+ }
+
+ return 0;
+}
+
+
+void METWriter::WriteChrSets()
+{
+ USHORT i;
+ char c;
+ METChrSet * pCS;
+ BYTE nbyte;
+
+ for (pCS=pChrSetList; pCS!=NULL; pCS=pCS->pSucc)
+ {
+
+ WriteFieldIntroducer(0x58,MapCodFntMagic,0,0);
+
+ WriteBigEndianShort(0x0050);
+
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ *pMET << (BYTE)0xa4 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x01;
+ *pMET << (BYTE)0x01 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+
+ *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x05 << (BYTE)pCS->nSet;
+
+ *pMET << (BYTE)0x14 << (BYTE)0x1f;
+ switch (pCS->eWeight)
+ {
+ case WEIGHT_THIN: nbyte=1; break;
+ case WEIGHT_ULTRALIGHT: nbyte=2; break;
+ case WEIGHT_LIGHT: nbyte=3; break;
+ case WEIGHT_SEMILIGHT: nbyte=4; break;
+ case WEIGHT_NORMAL: nbyte=5; break;
+ case WEIGHT_SEMIBOLD: nbyte=6; break;
+ case WEIGHT_BOLD: nbyte=7; break;
+ case WEIGHT_ULTRABOLD: nbyte=8; break;
+ case WEIGHT_BLACK: nbyte=9; break;
+ default: nbyte=5;
+ }
+ *pMET << nbyte;
+ *pMET << (BYTE)0x05;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x0c;
+
+ *pMET << (BYTE)0x06 << (BYTE)0x20 << (BYTE)0x03 << (BYTE)0xd4;
+ *pMET << (BYTE)0x03 << (BYTE)0x52;
+
+ *pMET << (BYTE)0x24 << (BYTE)0x02 << (BYTE)0x08 << (BYTE)0x00;
+ for (i=0; i<32; i++)
+ {
+ if ( i == 0 || c != 0 )
+ c = pCS->aName.GetChar( i );
+ *pMET << c;
+ }
+ }
+}
+
+
+void METWriter::WriteColorAttributeTable(ULONG nFieldId, BitmapPalette* pPalette, BYTE nBasePartFlags, BYTE nBasePartLCTID)
+{
+ USHORT nIndex,nNumI,i;
+
+ if (bStatus==FALSE) return;
+
+ //--- Das Feld 'Begin Color Attribute Table':
+ WriteFieldIntroducer(16,BegColAtrMagic,0,0);
+ WriteFieldId(nFieldId);
+
+ //--- Das Feld 'Color Attribute Table':
+ WriteFieldIntroducer(0,BlkColAtrMagic,0,0);
+ *pMET << nBasePartFlags << (BYTE)0x00 << nBasePartLCTID; // 'Base Part'
+ if (pPalette!=NULL)
+ {
+ nIndex=0;
+ while (nIndexGetEntryCount())
+ {
+ nNumI=pPalette->GetEntryCount()-nIndex;
+ if (nNumI>81) nNumI=81;
+ *pMET << (BYTE)(11+nNumI*3); // Laenge des Parameters
+ *pMET << (BYTE)1 << (BYTE)0 << (BYTE)1; // typ: element list, Reserved, Format: RGB
+ *pMET << (BYTE)0; WriteBigEndianShort(nIndex); // Start-Index (3 Bytes)
+ *pMET << (BYTE)8 << (BYTE)8 << (BYTE)8; // Bits je Komponente R,G,B
+ *pMET << (BYTE)3; // Anzahl Bytes je Eintrag
+ for (i=0; iGetError())
+ bStatus=FALSE;
+}
+
+
+void METWriter::WriteImageObject(const Bitmap & rBitmap)
+{
+ SvMemoryStream aTemp(0x00010000,0x00010000);
+ ULONG nWidth,nHeight,nResX,nResY,nBytesPerLine,i,j,nNumColors,ny,nLines;
+ ULONG nActColMapId;
+ USHORT nBitsPerPixel;
+ BYTE nbyte, * pBuf;
+
+ if (bStatus==FALSE)
+ return;
+
+ nActColMapId=((nActBitmapId>>24)&0x000000ff) | ((nActBitmapId>> 8)&0x0000ff00) |
+ ((nActBitmapId<< 8)&0x00ff0000) | ((nActBitmapId<<24)&0xff000000);
+
+ //--- Das Feld 'Begin Image Object':
+ WriteFieldIntroducer(16,BegImgObjMagic,0,0);
+ WriteFieldId(nActBitmapId);
+
+ // Windows-BMP-Datei erzeugen:
+ aTemp << rBitmap;
+
+ // Header der Windows-BMP-Datei einlesen:
+ aTemp.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ aTemp.Seek(18);
+ aTemp >> nWidth >> nHeight;
+ aTemp.SeekRel(2);
+ aTemp >> nBitsPerPixel;
+ aTemp.SeekRel(8);
+ aTemp >> nResX >> nResY;
+ aTemp.SeekRel(8);
+
+ nNumColors=1<> 3;
+
+ // ggf. Farbpalette einlesen und in die MET-Datei schreiben:
+ if (nBitsPerPixel<=8)
+ {
+ BitmapPalette aPal( (USHORT) nNumColors );
+ BYTE nr,ng,nb;
+
+ for (i=0; i> nb >> ng >> nr; aTemp.SeekRel(1);
+ aPal[ (USHORT) i ] = BitmapColor( nr, ng, nb );
+ }
+
+ //--- Das Feld 'Begin Resource Group':
+ WriteFieldIntroducer(16,BegResGrpMagic,0,0);
+ WriteFieldId(nActColMapId);
+
+ //--- Farbtabelle schreiben:
+ WriteColorAttributeTable(nActColMapId,&aPal,0,1);
+
+ //--- Das Feld 'End Resource Group':
+ WriteFieldIntroducer(16,EndResGrpMagic,0,0);
+ WriteFieldId(nActColMapId);
+
+ //--- Das Feld 'Begin Object Environment Group':
+ WriteFieldIntroducer(16,BegObjEnvMagic,0,0);
+ WriteFieldId(nActBitmapId);
+
+ //--- Das Feld 'Map Color Attribute Table':
+ WriteFieldIntroducer(26,MapColAtrMagic,0,0);
+ WriteBigEndianShort(0x0012);
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ WriteFieldId(nActColMapId);
+ *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x07 << (BYTE)0x01;
+
+ //--- Das Feld 'End Object Environment Group':
+ WriteFieldIntroducer(16,EndObjEnvMagic,0,0);
+ WriteFieldId(nActBitmapId);
+ }
+
+ //--- Das Feld 'Image Data Descriptor':
+ WriteFieldIntroducer(17,DscImgObjMagic,0,0);
+ *pMET << (BYTE)0x01; // Unit of measure: tens of centimeters
+ WriteBigEndianShort((USHORT)nResX);
+ WriteBigEndianShort((USHORT)nResY);
+ WriteBigEndianShort((USHORT)nWidth);
+ WriteBigEndianShort((USHORT)nHeight);
+
+ //--- Das erste Feld 'Image Picture Data':
+ WriteFieldIntroducer(0,DatImgObjMagic,0,0);
+
+ // Begin Segment:
+ *pMET << (BYTE)0x70 << (BYTE)0x00;
+
+ // Begin Image Content:
+ *pMET << (BYTE)0x91 << (BYTE)0x01 << (BYTE)0xff;
+
+ // Image Size:
+ *pMET << (BYTE)0x94 << (BYTE)0x09 << (BYTE)0x02;
+ *pMET << (USHORT) 0 << (USHORT) 0;
+ WriteBigEndianShort((USHORT)nHeight);
+ WriteBigEndianShort((USHORT)nWidth);
+
+ // Image Encoding:
+ *pMET << (BYTE)0x95 << (BYTE)0x02 << (BYTE)0x03 << (BYTE)0x03;
+
+ // Image IDE-Size:
+ *pMET << (BYTE)0x96 << (BYTE)0x01 << (BYTE)nBitsPerPixel;
+
+ if (nBitsPerPixel<=8) {
+ // Image LUT-ID
+ *pMET << (BYTE)0x97 << (BYTE)0x01 << (BYTE)0x01;
+ }
+ else {
+ // IDE Structure
+ *pMET << (BYTE)0x9b << (BYTE)0x08 << (BYTE)0x00 << (BYTE)0x01;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x08;
+ *pMET << (BYTE)0x08 << (BYTE)0x08;
+ }
+
+ pBuf=new BYTE[nBytesPerLine];
+ ny=0;
+ while (ny30000) nLines=30000/nBytesPerLine;
+ if (nLines<1) nLines=1;
+ WriteBigEndianShort(0xfe92);
+ WriteBigEndianShort((USHORT)(nLines*nBytesPerLine));
+ for (i=0; iWrite(pBuf,nBytesPerLine);
+ ny++;
+ }
+ if (aTemp.GetError() || pMET->GetError()) bStatus=FALSE;
+ nActBitmapPercent=(ny+1)*100/nHeight;
+ MayCallback();
+ if (bStatus==FALSE) { delete pBuf; return; }
+ }
+ delete pBuf;
+
+ // End Image Content:
+ *pMET << (BYTE)0x93 << (BYTE)0x00;
+
+ // End Segment:
+ *pMET << (BYTE)0x71 << (BYTE)0x00;
+
+ // Abschliessen des letzten Feldes 'Image Picture Data':
+ UpdateFieldSize();
+
+ //--- Das Feld 'End Image Object':
+ WriteFieldIntroducer(16,EndImgObjMagic,0,0);
+ WriteFieldId(nActBitmapId);
+
+ // Ids erhoehen:
+ nActBitmapId++;
+
+ // Bitmaps zaehlen:
+ nWrittenBitmaps++;
+ nActBitmapPercent=0;
+
+ if (pMET->GetError()) bStatus=FALSE;
+}
+
+
+void METWriter::WriteImageObjects(const GDIMetaFile * pMTF)
+{
+ const MetaAction* pMA;
+
+ if (bStatus==FALSE)
+ return;
+
+ for ( ULONG nAction = 0, nCount = pMTF->GetActionCount(); nAction < nCount; nAction++)
+ {
+ pMA = pMTF->GetAction(nAction);
+
+ switch (pMA->GetType())
+ {
+ case META_BMP_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( ( (MetaBmpAction*) pMA )->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( ( (MetaBmpScaleAction*) pMA )->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( ( (MetaBmpScalePartAction*) pMA )->GetBitmap() );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( Graphic( ( (MetaBmpExAction*) pMA )->GetBitmapEx() ).GetBitmap() );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( Graphic( ( (MetaBmpExScaleAction*) pMA )->GetBitmapEx() ).GetBitmap() );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( Graphic( ( (MetaBmpExScalePartAction*) pMA )->GetBitmapEx() ).GetBitmap() );
+ }
+ 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;
+ METSetMix( eGDIRasterOp );
+ WriteImageObject( pBmpScaleAction->GetBitmap() );
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ if (bStatus==FALSE)
+ break;
+ }
+
+ if (pMET->GetError())
+ bStatus=FALSE;
+}
+
+void METWriter::WriteDataDescriptor(const GDIMetaFile *)
+{
+ if (bStatus==FALSE)
+ return;
+
+ WriteFieldIntroducer(0,DscGrfObjMagic,0,0);
+
+ //------------------------------------------------------------------------------
+ // Im Folgenden die OS2-Orginal-Dokumentation und die Implementation dazu (uff)
+ //------------------------------------------------------------------------------
+
+ // Parameters (all required and in this order)
+
+ // 0 0xF7 Specify GVM Subset
+ // 1 Length of following data 0x07
+ // 2 0xB0 drawing order subset
+ // 3-4 0x0000
+ // 5 0x23 Level 3.2
+ // 6 0x01 Version 1
+ // 7 Length of following field 0x01
+ // 8 Coordinate types in data
+ // 0x04Intel16
+ // 0x05Intel32
+ *pMET << (BYTE)0xf7 << (BYTE)0x07 << (BYTE)0xb0 << (BYTE)0x00
+ << (BYTE)0x00 << (BYTE)0x23 << (BYTE)0x01 << (BYTE)0x01
+ << (BYTE)0x05;
+
+ // 0 0xF6 Set Picture Descriptor
+ // 1 Length of following data
+ // 2 Flags
+ // 0 B'0' Picture in 2D
+ // 1 Picture Dimensions
+ // B'0' Not absolute (PU_ARBITRARY PS)
+ // B'1' Absolute (example: PU_TWIPS PS)
+ // 2 Picture Elements
+ // B'0' Not pels
+ // B'1' Pels (PU_PELS PS)
+ // (Bit 1 must also be set)
+ // 3-7 B'00000'
+ // 3 0x00 Reserved
+ // 4 Picture frame size coordinate type
+ // 0x04 Intel16
+ // 0x05 Intel32
+ // 5 UnitsOfMeasure
+ // 0x00 Ten inches
+ // 0x01 Decimeter
+ // 6-11 or 6-17(2 or 4 bytes) Resolution.
+ // GPS Units / UOM on x axis
+ // GPS Units / UOM on y axis
+ // GPS Units / UOM on z axis
+ // 12-23 or 18-41(2 or 4 bytes) Window Size.
+ // GPS X left, X right
+ // GPS Y bottom, Y top
+ // GPS Z near, Z far
+ Size aUnitsPerDecimeter=OutputDevice::LogicToLogic(Size(10,10),MapMode(MAP_CM),aPictureMapMode);
+ *pMET << (BYTE)0xf6 << (BYTE)0x28 << (BYTE)0x40 << (BYTE)0x00
+ << (BYTE)0x05 << (BYTE)0x01
+ << (ULONG)(aUnitsPerDecimeter.Width())
+ << (ULONG)(aUnitsPerDecimeter.Height())
+ << (ULONG)0
+ << (ULONG)0 << (ULONG)aPictureRect.GetWidth()
+ << (ULONG)0 << (ULONG)aPictureRect.GetHeight()
+ << (ULONG)0 << (ULONG)0;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Parameter Format 0x08
+ // 3-4 Mask 0xE000
+ // 5 Names 0x8F
+ // 6 Coordinates
+ // 0x00 Picture in 2D
+ // 7 Transforms
+ // 0x04 Intel16
+ // 0x05 Intel32
+ // 8 Geometrics
+ // 0x04 Intel16
+ // 0x05 Intel32
+ *pMET << (BYTE)0x21 << (BYTE)0x07 << (BYTE)0x08 << (BYTE)0xe0
+ << (BYTE)0x00 << (BYTE)0x8f << (BYTE)0x00 << (BYTE)0x05
+ << (BYTE)0x05;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set default viewing transform 0x07
+ // 3-4 Mask 0xCC0C
+ // 5 Names 0x8F
+ // 6-n M11, M12, M21, M22, M41, M42 Matrix elements
+ *pMET << (BYTE)0x21 << (BYTE)0x1c << (BYTE)0x07 << (BYTE)0xcc
+ << (BYTE)0x0c << (BYTE)0x8f
+ << (ULONG)0x00010000 << (ULONG)0x00000000 << (ULONG)0x00000000
+ << (ULONG)0x00010000 << (ULONG)0x00000000 << (ULONG)0x00000000;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set default line attributes 0x01
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 Line type
+ // 0x4000 Line width
+ // 0x2000 Line end
+ // 0x1000 Line join
+ // 0x0800 Stroke width
+ // 0x0008 Line color
+ // 0x0002 Line mix
+ // 5 Flags
+ //
+ // 0x0F Set indicated default attributes to initial values. (Data field is not present in this
+ // instance).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding mask flag was not
+ // set.
+ //
+ // (1 byte) - Line type
+ // (1 byte) - Line width
+ // (1 byte) - Line end
+ // (1 byte) - Line join
+ // (G bytes) - Stroke width
+ // (4 bytes) - Line color
+ // (1 byte) - Line mix (G=2 or 4 depending on the Geometrics parameter of Set Default
+ // Parameter Format)
+ // Nanu! witziger-weise fehlt obiger Abschnitt in den Metadateien. Also lassen wir ihn auch weg
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Character Attributes 0x02
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ //
+ // 0x8000 Character angle
+ // 0x4000 Character box
+ // 0x2000 Character direction
+ // 0x1000 Character precision
+ // 0x0800 Character set
+ // 0x0400 Character shear
+ // 0x0040 Character break extra
+ // 0x0020 Character extra
+ // 0x0008 Character color
+ // 0x0004 Character background color
+ // 0x0002 Character mix
+ // 0x0001 Character background mix
+ // 5 Flags
+ // 0x0FSet indicated default attributes to initial values. (Data field is not present in this
+ // case).
+ // 0x8FSet indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was not
+ // set.
+ // (2*G bytes) - Character angle
+ // (2*G + 4 bytes)- Character box
+ // (1 byte) - Character direction
+ // (1 byte) - Character precision
+ // (1 byte) - Character set
+ // (2*G bytes) - Character shear
+ // (4 bytes) - Character break extra
+ // (4 bytes) - Character extra
+ // (4 bytes) - Character color
+ // (4 bytes) - Character background color
+ // (1 byte) - Character mix
+ // (1 byte) - Character background mix (G=2 or 4 depending on the Geometrics
+ // parameter of Set Default Parameter Format)
+ *pMET << (BYTE)0x21 << (BYTE)0x10 << (BYTE)0x02 << (BYTE)0x40
+ << (BYTE)0x00 << (BYTE)0x8f
+ << (BYTE)0xaa << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00
+ << (BYTE)0x44 << (BYTE)0x04 << (BYTE)0x00 << (BYTE)0x00
+ << (BYTE)0xa8 << (BYTE)0xaa << (BYTE)0x40 << (BYTE)0x44;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Marker Attributes 0x03
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x4000 Marker box
+ // 0x1000 Marker precision
+ // 0x0800 Marker set
+ // 0x0100 Marker symbol
+ // 0x0008 Marker color
+ // 0x0004 Marker background color
+ // 0x0002 Marker mix
+ // 0x0001 Marker background mix
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this instance)
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in this order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was not
+ // set.
+ // (2*G bytes) - Marker box
+ // (1 byte) - Marker precision
+ // (1 byte) - Marker set
+ // (1 byte) - Marker symbol
+ // (4 bytes) - Marker color
+ // (4 bytes) - Marker background color
+ // (1 byte) - Marker mix
+ // (1 byte) - Marker background mix (G=2 or 4 depending on the Geometrics
+ // parameter of Set Default Parameter Format)
+ *pMET << (BYTE)0x21 << (BYTE)0x0c << (BYTE)0x03 << (BYTE)0x40
+ << (BYTE)0x00 << (BYTE)0x8f
+ << (BYTE)0x66 << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00
+ << (BYTE)0x66 << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00;
+
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Pattern Attributes 0x04
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x0800 Pattern set
+ // 0x0100 Pattern symbol
+ // 0x0080 Pattern reference point
+ // 0x0008 Pattern color
+ // 0x0004 Pattern background color
+ // 0x0002 Pattern mix
+ // 0x0001 Pattern background mix
+ // 5 Flags
+ //
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this instance)
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in this order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ //
+ // (1 byte) - Pattern set
+ // (1 byte) - Pattern symbol
+ // (2*G bytes) - Pattern reference point
+ // (4 bytes) - Pattern color
+ // (4 bytes) - Pattern background color
+ // (1 byte) - Pattern mix
+ // (1 byte) - Pattern background mix (G=2 or 4 depending on the Geometrics
+ // parameter of Set Default Parameter Format)
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Image Attributes 0x06
+ // 3-4 Mask - OR of as many of these bits as are required:
+ // 0x0008 Image color
+ // 0x0004 Image background color
+ // 0x0002 Image mix
+ // 0x0001 Image background mix
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values. (Data field is not present in
+ // this instance)
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in this order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (4 bytes) - Image color
+ // (4 bytes) - Image background color
+ // (1 byte) - Image mix
+ // (1 byte) - Image background mix
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Viewing Window 0x05
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 x left limit
+ // 0x4000 x right limit
+ // 0x2000 y bottom limit
+ // 0x1000 y top limit
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this case).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (2*G bytes) - x left limit
+ // (2*G bytes) - x right limit
+ // (2*G bytes) - y bottom limit
+ // (2*G bytes) - y top limit (G=2 or 4 depending on the Geometrics parameter of Set
+ // Default Parameter Format)
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Arc Parameters 0x0B
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 P value
+ // 0x4000 Q value
+ // 0x2000 R value
+ // 0x1000 S value
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this case).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (G bytes) - P value
+ // (G bytes) - Q value
+ // (G bytes) - R value
+ // (G bytes) - S value (G=2 or 4 depending on the Geometrics parameter of Set
+ // Default Parameter Format)
+ // 0 0x21 Set Current Defaults
+ // 1 Length of following data
+ // 2 Set Default Pick Identifier 0x0C
+ // 3-4 Mask - OR of as many of the following bits as are required:
+ // 0x8000 Pick identifier
+ // 5 Flags
+ // 0x0F Set indicated default attributes to initial values.
+ // (Data field is not present in this case).
+ // 0x8F Set indicated default attributes to specified values.
+ // 6-n Data - data values as required, in the following order if present.
+ // No space is reserved for attributes for which the corresponding Mask flag was
+ // not set.
+ // (4 bytes) - Pick identifier
+
+ // 0 0xE7 Set Bit-map Identifier
+ // 1 Length of following data 0x07
+ // 2-3 Usage Flags 0x8000
+ // 4-7 Bit-map handle
+ // 8 Lcid
+ if (nNumberOfBitmaps>0) {
+ *pMET << (BYTE)0xe7 << (BYTE)0x07 << (BYTE)0x80 << (BYTE)0x00;
+ WriteBigEndianLong(nActBitmapId);
+ *pMET << (BYTE)0xfe;
+ }
+
+ UpdateFieldSize();
+
+ if (pMET->GetError()) bStatus=FALSE;
+}
+
+
+void METWriter::WillWriteOrder(ULONG nNextOrderMaximumLength)
+{
+ // Die Parameter eines 'Graphics Data Fields' duerfen (laut OS2-Doku)
+ // hoechstens 32759 Bytes umfassen. Gemeint ist die Laenge des Feldes minus
+ // dem 'Structured Field Introducer' (groesse: 8). Also darf die Groesse
+ // des ganzen Fields hoechstens 8+32759=32767=0x7fff sein.
+ // Zur Sicherheit nehmen wir lieber 30000 als Grenze.
+
+ if (pMET->Tell()-nActualFieldStartPos+nNextOrderMaximumLength>30000)
+ {
+ UpdateFieldSize();
+ WriteFieldIntroducer(0,DatGrfObjMagic,0,0);
+ nNumberOfDataFields++;
+ }
+}
+
+
+
+void METWriter::METBitBlt(Point aPt, Size aSize, const Bitmap & rBitmap)
+{
+ WillWriteOrder(46);
+ *pMET << (BYTE)0xd6 << (BYTE)44 << (USHORT)0 << (USHORT) 0x00cc;
+ WriteBigEndianLong(nActBitmapId++);
+ *pMET << (BYTE)0x02 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ WritePoint(Point(aPt.X(),aPt.Y()+aSize.Height()));
+ WritePoint(Point(aPt.X()+aSize.Width(),aPt.Y()));
+ *pMET << (ULONG)0 << (ULONG)0
+ << (ULONG)(rBitmap.GetSizePixel().Width())
+ << (ULONG)(rBitmap.GetSizePixel().Height());
+}
+
+void METWriter::METSetAndPushLineInfo( const LineInfo& rLineInfo )
+{
+ INT32 nWidth = OutputDevice::LogicToLogic( Size( rLineInfo.GetWidth(),0 ), aPictureMapMode, aTargetMapMode ).Width();
+
+ WillWriteOrder( 8 ); // set stroke linewidth
+ *pMET << (BYTE)0x15
+ << (BYTE)6
+ << (BYTE)0 // Flags
+ << (BYTE)0
+ << nWidth;
+
+ if ( rLineInfo.GetStyle() != LINE_SOLID )
+ {
+ BYTE nStyle = 0; // LineDefault;
+
+ switch ( rLineInfo.GetStyle() )
+ {
+ case LINE_NONE :
+ nStyle = 8;
+ break;
+
+ case LINE_DASH :
+ {
+ if ( rLineInfo.GetDotCount() )
+ {
+ if ( !rLineInfo.GetDashCount() )
+ nStyle = 1; // LINE_DOT
+ else
+ nStyle = 3; // LINE_DASH_DOT
+ }
+ else
+ nStyle = 2; // LINE_DASH
+ }
+ break;
+ }
+ WillWriteOrder( 2 );
+ *pMET << (BYTE)0x18 << nStyle; // set LineType
+ }
+}
+
+void METWriter::METPopLineInfo( const LineInfo& rLineInfo )
+{
+ WillWriteOrder( 8 ); // set stroke linewidth
+ *pMET << (BYTE)0x15
+ << (BYTE)6
+ << (BYTE)0 // Flags
+ << (BYTE)0
+ << (UINT32)1;
+
+ if ( rLineInfo.GetStyle() != LINE_SOLID )
+ {
+ WillWriteOrder( 2 );
+ *pMET << (BYTE)0x18 << (BYTE)0; // set LineType
+ }
+}
+
+void METWriter::METBeginArea(BOOL bBoundaryLine)
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x68;
+ if (bBoundaryLine) *pMET << (BYTE)0xc0;
+ else *pMET << (BYTE)0x80;
+}
+
+
+void METWriter::METEndArea()
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x60 << (BYTE)0;
+}
+
+
+void METWriter::METBeginPath(ULONG nPathId)
+{
+ WillWriteOrder(8);
+ *pMET << (BYTE)0xd0 << (BYTE)6 << (USHORT) 0 << nPathId;
+}
+
+
+void METWriter::METEndPath()
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x7f << (BYTE)0;
+}
+
+
+void METWriter::METFillPath(ULONG nPathId)
+{
+ WillWriteOrder(8);
+ *pMET << (BYTE)0xd7 << (BYTE)6
+ << (BYTE)0x00 << (BYTE)0 << nPathId;
+}
+
+
+void METWriter::METOutlinePath(ULONG nPathId)
+{
+ WillWriteOrder(8);
+ *pMET << (BYTE)0xd4 << (BYTE)6
+ << (BYTE)0 << (BYTE)0 << nPathId;
+}
+
+
+void METWriter::METCloseFigure()
+{
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x7d << (BYTE)0;
+}
+
+
+void METWriter::METMove(Point aPt)
+{
+ WillWriteOrder(10);
+ *pMET << (BYTE)0x21 << (BYTE)8;
+ WritePoint(aPt);
+}
+
+
+void METWriter::METLine(Point aPt1, Point aPt2)
+{
+ WillWriteOrder(18);
+ *pMET << (BYTE)0xc1 << (BYTE)16;
+ WritePoint(aPt1); WritePoint(aPt2);
+}
+
+
+void METWriter::METLine(const Polygon & rPolygon)
+{
+ USHORT nNumPoints,i,j,nOrderPoints;
+ BOOL bFirstOrder;
+
+ bFirstOrder=TRUE;
+ i=0; nNumPoints=rPolygon.GetSize();
+ while (i30) nOrderPoints=30;
+ WillWriteOrder(nOrderPoints*8+2);
+ if (bFirstOrder==TRUE) {
+ *pMET << (BYTE)0xc1; // Line at given pos
+ bFirstOrder=FALSE;
+ }
+ else {
+ *pMET << (BYTE)0x81; // Line at current pos
+ }
+ *pMET << (BYTE)(nOrderPoints*8);
+ for (j=0; j360.0) fStartAngle-=360.0;
+ while (fStartAngle<0.0) fStartAngle+=360.0;
+ fSweepAngle*=180.0/3.14159265359;
+ while (fSweepAngle>360.0) fSweepAngle-=360.0;
+ while (fSweepAngle<.00) fSweepAngle+=360.0;
+ WillWriteOrder(22);
+ *pMET << (BYTE)0xa3 << (BYTE)20;
+ WritePoint(aCenter);
+ *pMET << (long)(fMultiplier*65536.0+0.5);
+ *pMET << (long)(fStartAngle*65536.0+0.5);
+ *pMET << (long)(fSweepAngle*65536.0+0.5);
+}
+
+
+void METWriter::METChrStr( Point aPt, String aUniStr )
+{
+ USHORT nLen,i;
+ ByteString aStr( aUniStr, RTL_TEXTENCODING_UTF8 );
+ nLen = aStr.Len();
+ WillWriteOrder( 11 + nLen );
+ *pMET << (BYTE)0xc3 << (BYTE)( 9 + nLen );
+ WritePoint(aPt);
+ for ( i = 0; i < nLen; i++ )
+ *pMET << aStr.GetChar( i );
+ *pMET << (BYTE)0;
+}
+
+
+void METWriter::METSetArcParams(long nP, long nQ, long nR, long nS)
+{
+ WillWriteOrder(18);
+ *pMET << (BYTE)0x22 << (BYTE)16 << nP << nQ << nR << nS;
+}
+
+
+void METWriter::METSetColor(Color aColor)
+{
+ if (aColor==aMETColor) return;
+ aMETColor=aColor;
+
+ WillWriteOrder(6);
+ *pMET << (BYTE)0xa6 << (BYTE)4 << (BYTE)0
+ << (BYTE)(aColor.GetBlue())
+ << (BYTE)(aColor.GetGreen())
+ << (BYTE)(aColor.GetRed());
+}
+
+
+void METWriter::METSetBackgroundColor(Color aColor)
+{
+ if (aColor==aMETBackgroundColor) return;
+ aMETBackgroundColor=aColor;
+
+ WillWriteOrder(6);
+ *pMET << (BYTE)0xa7 << (BYTE)4 << (BYTE)0
+ << (BYTE)(aColor.GetBlue())
+ << (BYTE)(aColor.GetGreen())
+ << (BYTE)(aColor.GetRed());
+}
+
+void METWriter::METSetMix(RasterOp eROP)
+{
+ BYTE nMix;
+
+ if (eMETMix==eROP)
+ return;
+
+ eMETMix=eROP;
+
+ switch (eROP)
+ {
+ case ROP_INVERT: nMix=0x0c; break;
+ case ROP_XOR: nMix=0x04; break;
+ default: nMix=0x02;
+ }
+
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x0c << nMix;
+}
+
+
+void METWriter::METSetChrCellSize(Size aSize)
+{
+ if (aMETChrCellSize==aSize)
+ return;
+
+ aMETChrCellSize=aSize;
+ WillWriteOrder(10);
+ if (aSize.Width()==0) aSize.Width()=aSize.Height();
+ *pMET << (BYTE)0x33 << (BYTE)8 << (long)aSize.Width() << (long)aSize.Height();
+}
+
+
+void METWriter::METSetChrAngle(short nAngle)
+{
+ double fa;
+ long nax,nay;
+
+ if (nMETChrAngle==nAngle) return;
+ nMETChrAngle=nAngle;
+
+ if (nAngle==0)
+ {
+ nax=256;
+ nay=0;
+ }
+ else
+ {
+ fa=((double)nAngle)/1800.0*3.14159265359;
+ nax=(long)(256.0*cos(fa)+0.5);
+ nay=(long)(256.0*sin(fa)+0.5);
+ }
+
+ WillWriteOrder(10);
+ *pMET << (BYTE)0x34 << (BYTE)8 << nax << nay;
+}
+
+
+void METWriter::METSetChrSet(BYTE nSet)
+{
+ if (nMETChrSet==nSet)
+ return;
+
+ nMETChrSet=nSet;
+ WillWriteOrder(2);
+ *pMET << (BYTE)0x38 << nSet;
+}
+
+
+void METWriter::WriteOrders( const GDIMetaFile* pMTF )
+{
+ if(bStatus==FALSE)
+ return;
+
+ for( ULONG nA = 0, nACount = pMTF->GetActionCount(); nA < nACount; nA++ )
+ {
+ const MetaAction* pMA = pMTF->GetAction( nA );
+
+ switch (pMA->GetType())
+ {
+ case META_PIXEL_ACTION:
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pMA;
+ METSetMix( eGDIRasterOp );
+ METSetColor( pA->GetColor() );
+ METLine( pA->GetPoint(),pA->GetPoint() );
+ }
+ break;
+
+ case META_POINT_ACTION:
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pMA;
+
+ METSetArcParams(1,1,0,0);
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginArea(FALSE);
+ METFullArc(pA->GetPoint(),0.5);
+ METEndArea();
+ }
+ break;
+
+ case META_LINE_ACTION:
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pMA;
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ LineInfo aLineInfo( pA->GetLineInfo() );
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METSetAndPushLineInfo( aLineInfo );
+
+ METSetMix( eGDIRasterOp );
+ METSetColor(aGDILineColor);
+ METBeginPath( 1 );
+ METLine( pA->GetStartPoint(), pA->GetEndPoint() );
+ METEndPath();
+ METOutlinePath( 1 );
+
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METPopLineInfo( aLineInfo );
+ }
+ }
+ break;
+
+ case META_RECT_ACTION:
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pMA;
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBox( TRUE, FALSE, pA->GetRect(), 0, 0 );
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBox( FALSE, TRUE, pA->GetRect(), 0, 0 );
+ }
+ }
+ break;
+
+ case META_ROUNDRECT_ACTION:
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pMA;
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBox( TRUE, FALSE, pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBox( FALSE, TRUE, pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+ }
+ break;
+
+ case META_ELLIPSE_ACTION:
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pMA;
+ Point aCenter;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+
+ METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0);
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBeginArea(FALSE);
+ METFullArc(aCenter,0.5);
+ METEndArea();
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METFullArc( aCenter,0.5 );
+ }
+ }
+ break;
+
+ case META_ARC_ACTION:
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pMA;
+ Point aStartPos,aCenter;
+ double fdx,fdy,fa1,fa2;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+ fdx=(double)(pA->GetStartPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa1=atan2(-fdy,fdx);
+ fdx=(double)(pA->GetEndPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa2=atan2(-fdy,fdx);
+ aStartPos.X()=aCenter.X()+(long)(((double)pA->GetRect().GetWidth())*cos(fa1)/2.0+0.5);
+ aStartPos.Y()=aCenter.Y()-(long)(((double)pA->GetRect().GetHeight())*sin(fa1)/2.0+0.5);
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0);
+ METBeginPath(1);
+ METMove(aStartPos);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_PIE_ACTION:
+ {
+ const MetaPieAction* pA = (const MetaPieAction*) pMA;
+ Point aCenter;
+ double fdx,fdy,fa1,fa2;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+ fdx=(double)(pA->GetStartPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa1=atan2(-fdy,fdx);
+ fdx=(double)(pA->GetEndPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa2=atan2(-fdy,fdx);
+
+ METSetArcParams(pA->GetRect().GetWidth(), pA->GetRect().GetHeight(),0,0);
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBeginPath(1);
+ METMove(aCenter);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aCenter);
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBeginPath(1);
+ METMove(aCenter);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aCenter);
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_CHORD_ACTION:
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pMA;
+ Point aStartPos,aCenter;
+ double fdx,fdy,fa1,fa2;
+
+ aCenter.X()=(pA->GetRect().Left()+pA->GetRect().Right())/2;
+ aCenter.Y()=(pA->GetRect().Top()+pA->GetRect().Bottom())/2;
+ fdx=(double)(pA->GetStartPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetStartPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa1=atan2(-fdy,fdx);
+ fdx=(double)(pA->GetEndPoint().X()-aCenter.X());
+ fdy=(double)(pA->GetEndPoint().Y()-aCenter.Y());
+ fdx*=(double)pA->GetRect().GetHeight();
+ fdy*=(double)pA->GetRect().GetWidth();
+ if (fdx==0.0 && fdy==0.0) fdx=1.0;
+ fa2=atan2(-fdy,fdx);
+ aStartPos.X()=aCenter.X()+(long)(((double)pA->GetRect().GetWidth())*cos(fa1)/2.0+0.5);
+ aStartPos.Y()=aCenter.Y()-(long)(((double)pA->GetRect().GetHeight())*sin(fa1)/2.0+0.5);
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDIFillColor );
+ METSetBackgroundColor( aGDIFillColor );
+ METBeginPath(1);
+ METMove(aStartPos);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aStartPos);
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix( eGDIRasterOp );
+ METSetColor( aGDILineColor );
+ METBeginPath(1);
+ METMove(aStartPos);
+ METPartialArcAtCurPos(aCenter,0.5,fa1,fa2-fa1);
+ METLineAtCurPos(aStartPos);
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_POLYLINE_ACTION:
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ LineInfo aLineInfo( pA->GetLineInfo() );
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METSetAndPushLineInfo( aLineInfo );
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginPath(1);
+ METLine(pA->GetPolygon());
+ METEndPath();
+ METOutlinePath(1);
+
+ if ( ! ( aLineInfo.IsDefault() ) )
+ METPopLineInfo( aLineInfo );
+ }
+ }
+ break;
+
+ case META_POLYGON_ACTION:
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pMA;
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFillColor );
+ METSetBackgroundColor(aGDIFillColor );
+ METBeginPath(1);
+ METLine(pA->GetPolygon());
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor );
+ METBeginPath(1);
+ METLine(pA->GetPolygon());
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_POLYPOLYGON_ACTION:
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pMA;
+
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFillColor);
+ METSetBackgroundColor(aGDIFillColor);
+ METBeginPath(1);
+ METLine(pA->GetPolyPolygon());
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginPath(1);
+ METLine(pA->GetPolyPolygon());
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pMA;
+ Point aPt( pA->GetPoint() );
+
+ if( aGDIFont.GetAlign() != ALIGN_BASELINE)
+ {
+ VirtualDevice aVDev;
+
+ if( aGDIFont.GetAlign()==ALIGN_TOP )
+ aPt.Y()+=(long)aVDev.GetFontMetric( aGDIFont ).GetAscent();
+ else
+ aPt.Y()-=(long)aVDev.GetFontMetric( aGDIFont ).GetDescent();
+ }
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFont.GetColor());
+ METSetBackgroundColor(aGDIFont.GetFillColor());
+ METSetChrCellSize(aGDIFont.GetSize());
+ METSetChrAngle(aGDIFont.GetOrientation());
+ METSetChrSet(FindChrSet(aGDIFont));
+ METChrStr(aPt, String(pA->GetText(),pA->GetIndex(),pA->GetLen()));
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA;
+ USHORT i;
+ String aStr;
+ Polygon aPolyDummy(1);
+ short nOrientation;
+ Point aPt( pA->GetPoint() );
+
+ if( aGDIFont.GetAlign() != ALIGN_BASELINE )
+ {
+ VirtualDevice aVDev;
+ if( aGDIFont.GetAlign() == ALIGN_TOP )
+ aPt.Y()+=(long)aVDev.GetFontMetric(aGDIFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVDev.GetFontMetric(aGDIFont).GetDescent();
+ }
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFont.GetColor());
+ METSetBackgroundColor(aGDIFont.GetFillColor());
+ METSetChrCellSize(aGDIFont.GetSize());
+ METSetChrAngle( nOrientation = aGDIFont.GetOrientation() );
+ METSetChrSet(FindChrSet(aGDIFont));
+ aStr=String(pA->GetText(),pA->GetIndex(),pA->GetLen());
+
+ if( pA->GetDXArray()!=NULL )
+ {
+ Point aPt2;
+
+ for( i=0; i < aStr.Len(); i++ )
+ {
+ aPt2 = aPt;
+ if ( i > 0 )
+ {
+ aPt2.X() += pA->GetDXArray()[i-1];
+ if ( nOrientation )
+ {
+ aPolyDummy.SetPoint( aPt2, 0 );
+ aPolyDummy.Rotate( aPt, nOrientation );
+ aPt2 = aPolyDummy.GetPoint( 0 );
+ }
+ }
+ METChrStr( aPt2, String( aStr.GetChar( i ) ) );
+ }
+ }
+ else
+ METChrStr( aPt, aStr );
+ }
+ break;
+
+ case META_STRETCHTEXT_ACTION:
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pMA;
+ VirtualDevice aVDev;
+ USHORT i;
+ long* pDXAry;
+ sal_Int32 nNormSize;
+ String aStr;
+ Polygon aPolyDummy(1);
+ short nOrientation;
+ Point aPt( pA->GetPoint() );
+ Point aPt2;
+
+ aVDev.SetFont( aGDIFont );
+
+ if( aGDIFont.GetAlign() != ALIGN_BASELINE)
+ {
+ if( aGDIFont.GetAlign() == ALIGN_TOP )
+ aPt.Y()+=(long)aVDev.GetFontMetric().GetAscent();
+ else
+ aPt.Y()-=(long)aVDev.GetFontMetric().GetDescent();
+ }
+
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFont.GetColor());
+ METSetBackgroundColor(aGDIFont.GetFillColor());
+ METSetChrCellSize(aGDIFont.GetSize());
+ METSetChrAngle( nOrientation = aGDIFont.GetOrientation() );
+ METSetChrSet(FindChrSet(aGDIFont));
+ aStr=String(pA->GetText(),pA->GetIndex(),pA->GetLen());
+ pDXAry=new long[aStr.Len()];
+ nNormSize = aVDev.GetTextArray( aStr, pDXAry );
+
+ for ( i = 0; i < aStr.Len(); i++ )
+ {
+ aPt2 = aPt;
+ if ( i > 0 )
+ {
+ aPt2.X() += pDXAry[i-1]*((long)pA->GetWidth())/ nNormSize;
+ if ( nOrientation )
+ {
+ aPolyDummy.SetPoint( aPt2, 0 );
+ aPolyDummy.Rotate( aPt, nOrientation );
+ aPt2 = aPolyDummy.GetPoint( 0 );
+ }
+ }
+ METChrStr( aPt2, String( aStr.GetChar( i ) ) );
+ }
+
+ delete[] pDXAry;
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_TEXTRECT_ACTION!" );
+ }
+ break;
+
+ case META_BMP_ACTION:
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetBitmap().GetSizePixel(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA;
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA;
+ Bitmap aTmp( pA->GetBitmap() );
+
+ aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ METSetMix( eGDIRasterOp );
+ METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA;
+ Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), aTmp.GetSizePixel(), aTmp );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
+ Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetSize(), aTmp );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA;
+ Bitmap aTmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
+ }
+ 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;
+ METSetMix(eGDIRasterOp);
+ METBitBlt( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() );
+ break;
+ }
+ }
+ }
+ break;
+
+ case META_MASK_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MASK_ACTION!" );
+ }
+ break;
+
+ case META_MASKSCALE_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALE_ACTION!" );
+ }
+ break;
+
+ case META_MASKSCALEPART_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MASKSCALEPART_ACTION!" );
+ }
+ break;
+
+ case META_GRADIENT_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaGradientAction* pA = (const MetaGradientAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ WriteOrders( &aTmpMtf );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaHatchAction* pA = (const MetaHatchAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ WriteOrders( &aTmpMtf );
+ }
+ break;
+
+ case META_WALLPAPER_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_WALLPAPER_ACTION!" );
+ }
+ break;
+
+ case META_CLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_CLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_ISECTRECTCLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_ISECTRECTCLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_ISECTREGIONCLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_MOVECLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_MOVECLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_LINECOLOR_ACTION:
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aGDILineColor = pA->GetColor();
+ else
+ aGDILineColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_FILLCOLOR_ACTION:
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aGDIFillColor = pA->GetColor();
+ else
+ aGDIFillColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_TEXTCOLOR_ACTION:
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pMA;
+ aGDIFont.SetColor( pA->GetColor() );
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION:
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aGDIFont.SetFillColor( pA->GetColor() );
+ else
+ aGDIFont.SetFillColor( Color( COL_TRANSPARENT ) );
+ }
+ break;
+
+ case META_TEXTALIGN_ACTION:
+ {
+// DBG_ERROR( "Unsupported MET-Action: META_TEXTALIGN_ACTION!" );
+ }
+ break;
+
+ case META_MAPMODE_ACTION:
+ {
+ const MetaMapModeAction* pA = (const MetaMapModeAction*) pMA;
+
+ if( aPictureMapMode != pA->GetMapMode() )
+ {
+ if ( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE )
+ {
+ MapMode aMM = pA->GetMapMode();
+ Fraction aScaleX = aMM.GetScaleX();
+ Fraction aScaleY = aMM.GetScaleY();
+
+ Point aOrigin = aPictureMapMode.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();
+ aPictureMapMode.SetOrigin( aOrigin );
+
+ aScaleX *= aPictureMapMode.GetScaleX();
+ aScaleY *= aPictureMapMode.GetScaleY();
+ aPictureMapMode.SetScaleX( aScaleX );
+ aPictureMapMode.SetScaleY( aScaleY );
+ }
+ else
+ aPictureMapMode=pA->GetMapMode();
+ }
+ }
+ break;
+
+ case META_FONT_ACTION:
+ {
+ aGDIFont = ( (const MetaFontAction*) pMA )->GetFont();
+ }
+ break;
+
+ case META_PUSH_ACTION:
+ {
+ METGDIStackMember* pGS = new METGDIStackMember;
+
+ pGS->pSucc=pGDIStack; pGDIStack=pGS;
+ pGS->aLineColor=aGDILineColor;
+ pGS->aFillColor=aGDIFillColor;
+ pGS->eRasterOp=eGDIRasterOp;
+ pGS->aFont=aGDIFont;
+ pGS->aMapMode=aPictureMapMode;
+ pGS->aClipRegion=aGDIClipRegion;
+ }
+ break;
+
+ case META_POP_ACTION:
+ {
+ METGDIStackMember* pGS;
+
+ if( pGDIStack )
+ {
+ pGS=pGDIStack; pGDIStack=pGS->pSucc;
+ aGDILineColor=pGS->aLineColor;
+ aGDIFillColor=pGS->aFillColor;
+ eGDIRasterOp=pGS->eRasterOp;
+ aGDIFont=pGS->aFont;
+ aGDIClipRegion=pGS->aClipRegion;
+ aPictureMapMode=pGS->aMapMode;
+ delete pGS;
+ }
+ }
+ break;
+
+ case META_RASTEROP_ACTION:
+ {
+ eGDIRasterOp = ( (const MetaRasterOpAction*) pMA )->GetRasterOp();
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ if( aGDIFillColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDIFillColor);
+ METSetBackgroundColor(aGDIFillColor);
+ METBeginPath(1);
+ METLine(( (const MetaTransparentAction*) pMA )->GetPolyPolygon());
+ METEndPath();
+ METFillPath(1);
+ }
+
+ if( aGDILineColor != Color( COL_TRANSPARENT ) )
+ {
+ METSetMix(eGDIRasterOp);
+ METSetColor(aGDILineColor);
+ METBeginPath(1);
+ METLine(( (const MetaTransparentAction*) pMA )->GetPolyPolygon());
+ METEndPath();
+ METOutlinePath(1);
+ }
+ }
+ 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;
+
+ 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 );
+
+ WriteOrders( &aTmpMtf );
+ }
+ break;
+ }
+
+ nWrittenActions++;
+ MayCallback();
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+
+ if( bStatus == FALSE )
+ break;
+ }
+}
+
+void METWriter::WriteObjectEnvironmentGroup(const GDIMetaFile * pMTF)
+{
+ ULONG i, nId;
+
+ //--- Das Feld 'Begin Object Environment Group':
+ WriteFieldIntroducer(16,BegObjEnvMagic,0,0);
+ WriteFieldId(7);
+
+ //--- Das Feld 'Map Color Attribute Table':
+ WriteFieldIntroducer(22,MapColAtrMagic,0,0);
+ WriteBigEndianShort(0x000e);
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ WriteFieldId(4);
+
+ //--- Das erste Feld 'Map Coded Font':
+ WriteFieldIntroducer(32,MapCodFntMagic,0,0);
+ WriteBigEndianShort(0x0018);
+ *pMET << (BYTE)0x0c << (BYTE)0x02 << (BYTE)0x84 << (BYTE)0x00;
+ *pMET << (BYTE)0xff << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x04 << (BYTE)0x24 << (BYTE)0x05 << (BYTE)0x00;
+ *pMET << (BYTE)0x06 << (BYTE)0x20;
+ *pMET << (BYTE)0x03 << (BYTE)0x97 << (BYTE)0x01 << (BYTE)0xb5;
+
+ //--- Die weiteren Felder 'Map Coded Font':
+ CreateChrSets(pMTF);
+ WriteChrSets();
+
+ //--- Die Felder 'Map Data Resource':
+ nId=nActBitmapId;
+ for (i=0; iTell();
+
+ //--- Anfang des ersten Feldes 'Graphics Data'
+ WriteFieldIntroducer(0,DatGrfObjMagic,0,0);
+ nNumberOfDataFields++;
+
+ // Nun schreiben wir zunaechst den Kopf des Segments:
+ *pMET << (BYTE)0x70 << (BYTE)0x0e << (ULONG)0;
+ *pMET << (BYTE)0x70 << (BYTE)0x10; // Flags
+ *pMET << (USHORT)0; // Lo-Wort der Laenge der Segementdaten (Big Endian)
+ *pMET << (ULONG)0; // Reserved
+ *pMET << (USHORT)0; // Hi-Wort der Laenge der Segementdaten (Big Endian) (Ohh Ohh OS2)
+ // Anmerkung: die richtige Daten-Laenge schreiben wir weiter unten nochmal
+
+ // Jetzt werden alle Orders rausgeschrieben:
+ // (wobei die Sache ggf. in mehrere 'Graphics Data Fields' aufgeteilt
+ // wird, per Methode WillWriteOrder(..))
+ WriteOrders(pMTF);
+
+ //--- Das letzte Feld 'Graphic Data' beenden:
+ UpdateFieldSize();
+
+ //--- Und schliesslich die Segmentgroesse richtigstellen:
+ nPos=pMET->Tell();
+ nSegmentSize=nPos-nDataFieldsStartPos;
+ nSegmentSize-=nNumberOfDataFields*8; // Structured Field Introducers zaehlen nicht mit
+ pMET->Seek(nDataFieldsStartPos+16); // Zum Lo-Wort der Segmentgroesse seeken
+ WriteBigEndianShort((USHORT)(nSegmentSize&0x0000ffff)); // Und schreiben
+ pMET->Seek(nDataFieldsStartPos+22); // Zum Hi-Wort der Segmentgroesse seeken
+ WriteBigEndianShort((USHORT)(nSegmentSize>>16)); // Und schreiben
+ pMET->Seek(nPos); // Zurueck zur Tagesordnung
+
+ //--- Das Feld 'End Graphic Objects':
+ WriteFieldIntroducer(16,EndGrfObjMagic,0,0);
+ WriteFieldId(7);
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+}
+
+
+void METWriter::WriteResourceGroup(const GDIMetaFile * pMTF)
+{
+ if( bStatus==FALSE )
+ return;
+
+ //--- Das Feld 'Begin Resource Group':
+ WriteFieldIntroducer(16,BegResGrpMagic,0,0);
+ WriteFieldId(2);
+
+ //--- Der Inhalt:
+ WriteColorAttributeTable();
+ nActBitmapId=0x77777700;
+ WriteImageObjects(pMTF);
+ nActBitmapId=0x77777700;
+ WriteGraphicsObject(pMTF);
+
+ //--- Das Feld 'End Resource Group':
+ WriteFieldIntroducer(16,EndResGrpMagic,0,0);
+ WriteFieldId(2);
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+}
+
+
+void METWriter::WriteDocument(const GDIMetaFile * pMTF)
+{
+ if( bStatus==FALSE )
+ return;
+
+ //--- Das Feld 'Begin Document':
+ WriteFieldIntroducer(0,BegDocumnMagic,0,0);
+ WriteFieldId(1);
+ *pMET << (BYTE)0x00 << (BYTE)0x00;
+ *pMET << (BYTE)0x05 << (BYTE)0x18 << (BYTE)0x03 << (BYTE)0x0c << (BYTE)0x00;
+ *pMET << (BYTE)0x06 << (BYTE)0x01 << (BYTE)0x03 << (BYTE)0xd4 << (BYTE)0x03 << (BYTE)0x52;
+ *pMET << (BYTE)0x03 << (BYTE)0x65 << (BYTE)0x00;
+ UpdateFieldSize();
+
+ //--- Der Inhalt:
+ WriteResourceGroup(pMTF);
+
+ //--- Das Feld 'End Document':
+ WriteFieldIntroducer(16,EndDocumnMagic,0,0);
+ WriteFieldId(1);
+
+ if( pMET->GetError() )
+ bStatus=FALSE;
+}
+
+
+BOOL METWriter::WriteMET( const GDIMetaFile& rMTF, SvStream& rTargetStream,
+ PFilterCallback pcallback, void* pcallerdata )
+{
+ METChrSet* pCS;
+ METGDIStackMember* pGS;
+
+ bStatus=TRUE;
+
+ pCallback=pcallback;
+ pCallerData=pcallerdata;
+ nLastPercent=0;
+
+ pMET=&rTargetStream;
+ pMET->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+
+ aPictureRect = Rectangle( Point(), rMTF.GetPrefSize() );
+ aTargetMapMode = aPictureMapMode = rMTF.GetPrefMapMode();
+
+ aGDILineColor=Color( COL_BLACK );
+ aGDIFillColor=Color( COL_WHITE );
+ eGDIRasterOp=ROP_OVERPAINT;
+ aGDIFont=Font();
+ aGDIMapMode=MapMode();
+ aGDIClipRegion=Region();
+ pGDIStack=NULL;
+ aMETColor=Color(COL_BLACK);
+ aMETBackgroundColor=Color(COL_WHITE);
+ eMETMix=ROP_OVERPAINT;
+ nMETStrokeLineWidth=1;
+ aMETChrCellSize=Size(0,0);
+ nMETChrAngle=0;
+ nMETChrSet=0x00;
+ pChrSetList=NULL;
+ nNextChrSetId=1;
+ nNumberOfActions=0;
+ nNumberOfBitmaps=0;
+ nWrittenActions=0;
+ nWrittenBitmaps=0;
+ nActBitmapPercent=0;
+
+ CountActionsAndBitmaps(&rMTF);
+
+ WriteDocument(&rMTF);
+
+ while( pChrSetList )
+ {
+ pCS=pChrSetList;
+ pChrSetList=pCS->pSucc;
+ delete pCS;
+ }
+
+ while( pGDIStack )
+ {
+ pGS=pGDIStack;
+ pGDIStack=pGS->pSucc;
+ delete pGS;
+ }
+
+ return bStatus;
+}
+
+//================== GraphicExport - die exportierte Funktion ================
+
+#ifdef WNT
+extern "C" BOOL _cdecl GraphicExport(SvStream & rStream, Graphic & rGraphic,
+ PFilterCallback pCallback, void * pCallerData,
+ Config *, BOOL)
+#else
+extern "C" BOOL GraphicExport(SvStream & rStream, Graphic & rGraphic,
+ PFilterCallback pCallback, void * pCallerData,
+ Config *, BOOL)
+#endif
+{
+ METWriter aMETWriter;
+
+ if (rGraphic.GetType()==GRAPHIC_GDIMETAFILE) {
+ return aMETWriter.WriteMET(rGraphic.GetGDIMetaFile(),rStream,pCallback,pCallerData);
+ }
+ else {
+ Bitmap aBmp=rGraphic.GetBitmap();
+ GDIMetaFile aMTF;
+ VirtualDevice aVirDev;
+
+ aMTF.Record(&aVirDev);
+ aVirDev.DrawBitmap(Point(),aBmp);
+ aMTF.Stop();
+ aMTF.SetPrefSize(aBmp.GetSizePixel());
+ return aMETWriter.WriteMET(aMTF,rStream,pCallback,pCallerData);
+ }
+}
+
+//================== GraphicDialog - die exportierte Funktion ================
+
+extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow && rPara.pCfg )
+ {
+ ByteString aResMgrName( "eme" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEMET( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+
+#pragma hdrstop
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/eos2met/eos2mstr.src b/goodies/source/filter.vcl/eos2met/eos2mstr.src
new file mode 100644
index 000000000000..004c94690514
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/eos2mstr.src
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: eos2mstr.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "strings.hrc"
+
+String KEY_MODE
+{
+ Text = "MET-EXPORT-MODE";
+};
+
+String KEY_SIZEX
+{
+ Text = "MET-EXPORT-SIZEX";
+};
+
+String KEY_SIZEY
+{
+ Text = "MET-EXPORT-SIZEY";
+};
diff --git a/goodies/source/filter.vcl/eos2met/makefile.mk b/goodies/source/filter.vcl/eos2met/makefile.mk
new file mode 100644
index 000000000000..b4255701e68f
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/makefile.mk
@@ -0,0 +1,180 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=eos2met
+TARGET2=eme
+DEPTARGET=veos2met
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRCFILES= dlgeos2.src \
+ eos2mstr.src
+
+SLOFILES = $(SLO)$/eos2met.obj \
+ $(SLO)$/dlgeos2.obj
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=\
+ $(SRS)$/$(TARGET).srs
+
+SHL1TARGET= eme$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= eos2met
+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB)
+
+SHL1DEPN= $(LB)$/eos2met.lib
+SHL1LIBS= $(SLB)$/eos2met.lib # $(LB)$/rtftoken.lib
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/eos2met.obj
+.ENDIF
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+ @echo _DoExportDialog >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET) >>$@
+ @echo GraphicExport_ >>temp.def
+ @echo DoExportDialog_ >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/eos2met/strings.hrc b/goodies/source/filter.vcl/eos2met/strings.hrc
new file mode 100644
index 000000000000..831e6b7e7ca6
--- /dev/null
+++ b/goodies/source/filter.vcl/eos2met/strings.hrc
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define KEY_MODE 260
+#define KEY_SIZEX 264
+#define KEY_SIZEY 266
+
diff --git a/goodies/source/filter.vcl/epbm/dlgepbm.cxx b/goodies/source/filter.vcl/epbm/dlgepbm.cxx
new file mode 100644
index 000000000000..438f657ebde6
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/dlgepbm.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepbm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+#include
+#include
+#include
+#include "dlgepbm.hxx"
+#include "dlgepbm.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPBM::DlgExportEPBM( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPBM, rPara.pResMgr ) ),
+ aGrpFormat ( this, ResId( GRP_FORMAT ) ),
+ aRBRaw ( this, ResId( RB_RAW ) ),
+ aRBASCII ( this, ResId( RB_ASCII ) ),
+ 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
+
+ String aFormatStr( ResId( KEY_FORMAT, pMgr ) );
+ sal_Int32 nFormat = pConfig->ReadKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+
+ BOOL bCheck = FALSE;
+ if ( !nFormat )
+ bCheck ^= TRUE;
+
+ aRBRaw.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBASCII.Check( bCheck );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPBM, OK ) );
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPBM, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+ String aStr;
+
+ sal_Int32 nCheck = 0;
+ if ( aRBASCII.IsChecked() )
+ nCheck++;
+ String aFormatStr( ResId( KEY_FORMAT, pMgr ) );
+ pConfig->WriteKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
diff --git a/goodies/source/filter.vcl/epbm/dlgepbm.hrc b/goodies/source/filter.vcl/epbm/dlgepbm.hrc
new file mode 100644
index 000000000000..05db15d1099d
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/dlgepbm.hrc
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepbm.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "goodies.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_FORMAT 1
+#define RB_RAW 1
+#define RB_ASCII 2
diff --git a/goodies/source/filter.vcl/epbm/dlgepbm.hxx b/goodies/source/filter.vcl/epbm/dlgepbm.hxx
new file mode 100644
index 000000000000..d44d23448d1b
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/dlgepbm.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepbm.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DLGEPBM_HXX_
+#define _DLGEPBM_HXX_
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class Config;
+class ResMgr;
+
+class DlgExportEPBM : public ModalDialog
+{
+private:
+ GroupBox aGrpFormat;
+ RadioButton aRBRaw;
+ RadioButton aRBASCII;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEPBM( FltCallDialogParameter& rPara );
+};
+
+#endif // _DLGEPBM_HXX_
diff --git a/goodies/source/filter.vcl/epbm/dlgepbm.src b/goodies/source/filter.vcl/epbm/dlgepbm.src
new file mode 100644
index 000000000000..e6884904c923
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/dlgepbm.src
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepbm.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "dlgepbm.hrc"
+ModalDialog DLG_EXPORT_EPBM
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 133 , 67 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text = "PBM Optionen" ;
+ Text [ ENGLISH ] = "PBM options" ;
+ Text [ english_us ] = "PBM Options" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 73 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 73 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 73 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ GroupBox GRP_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 54 ) ;
+ Text = "Datei Format" ;
+ Text [ ENGLISH ] = "file format" ;
+ Text[ italian ] = "Formato file";
+ Text[ portuguese_brazilian ] = "Datei Format";
+ Text[ portuguese ] = "Formato do ficheiro";
+ Text[ danish ] = "Filformat";
+ Text[ french ] = "Format de fichier";
+ Text[ swedish ] = "Filformat";
+ Text[ dutch ] = "Bestandsformaat";
+ Text[ spanish ] = "Formato de archivo";
+ Text[ english_us ] = "File format";
+ Text[ chinese_simplified ] = "Îļþ¸ñʽ";
+ Text[ russian ] = "Ôîðìàò ôàéëà";
+ Text[ polish ] = "Format pliku";
+ Text[ japanese ] = "̧²Ù‚Ì‘Ž®";
+ Text[ chinese_traditional ] = "Àɮ׮榡";
+ Text[ arabic ] = "ÊäÓíÞ ÇáãáÝ";
+ Text[ dutch ] = "Bestandsformaat";
+ Text[ chinese_simplified ] = "Îļþ¸ñʽ";
+ Text[ greek ] = "ÌïñöÞ áñ÷åßïõ";
+ Text[ korean ] = "ÆÄÀÏ ¼½Ä";
+ Text[ turkish ] = "Dosya formatý";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_RAW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Binär" ;
+ Text [ ENGLISH ] = "~raw" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Binario";
+ Text[ portuguese_brazilian ] = "~Binär";
+ Text[ portuguese ] = "~Binário";
+ Text[ danish ] = "~Binær";
+ Text[ french ] = "~Binaire";
+ Text[ swedish ] = "~Binär";
+ Text[ dutch ] = "~Binair";
+ Text[ spanish ] = "~Binario";
+ Text[ english_us ] = "~Binary";
+ Text[ chinese_simplified ] = "¶þÔª(~B)";
+ Text[ russian ] = "Áèíàðíûé";
+ Text[ polish ] = "Binarny";
+ Text[ japanese ] = "ÊÞ²ÅØ(~B)";
+ Text[ language_user1 ] = " ";
+ Text[ chinese_traditional ] = "¤G¦ì¤¸(~B)";
+ Text[ arabic ] = "ËäÇÆí";
+ Text[ dutch ] = "~Binair";
+ Text[ chinese_simplified ] = "¶þÔª(~B)";
+ Text[ greek ] = "Äõáäéêü";
+ Text[ korean ] = "¹ÙÀ̳ʸ®(~B)";
+ Text[ turkish ] = "Ýkili";
+ };
+ RadioButton RB_ASCII
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Text" ;
+ Text [ ENGLISH ] = "~text" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Testo";
+ Text[ portuguese_brazilian ] = "~Text";
+ Text[ portuguese ] = "~Texto";
+ Text[ danish ] = "~Tekst";
+ Text[ french ] = "~Texte";
+ Text[ swedish ] = "~Text";
+ Text[ dutch ] = "~Tekst";
+ Text[ spanish ] = "~Texto";
+ Text[ english_us ] = "~Text";
+ Text[ chinese_simplified ] = "ÎÄ×Ö(~T)";
+ Text[ russian ] = "Òåêñò";
+ Text[ polish ] = "Tekst";
+ Text[ japanese ] = "÷½Ä(~T)";
+ Text[ chinese_traditional ] = "¤å¦r(~T)";
+ Text[ arabic ] = "ÇáäÕ";
+ Text[ dutch ] = "~Tekst";
+ Text[ chinese_simplified ] = "ÎÄ×Ö(~T)";
+ Text[ greek ] = "Êåßìåíï";
+ Text[ korean ] = "ÅؽºÆ®(~T)";
+ Text[ turkish ] = "Metin";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ italian ] = "Opzioni PBM";
+ Text[ portuguese_brazilian ] = "PBM Optionen";
+ Text[ portuguese ] = "Opções PBM";
+ Text[ danish ] = "PBM indstillinger";
+ Text[ french ] = "Options PBM";
+ Text[ swedish ] = "PBM alternativ";
+ Text[ dutch ] = "PBM-opties";
+ Text[ spanish ] = "Opciones PBM ";
+ Text[ chinese_simplified ] = "PBM Ñ¡Ïî";
+ Text[ russian ] = "Ïàðàìåòðû PBM";
+ Text[ polish ] = "Opcje PBM ";
+ Text[ japanese ] = "PBM µÌß¼®Ý";
+ Text[ chinese_traditional ] = "PBM¿ï¶µ";
+ Text[ arabic ] = "PBM ÎíÇÑÇÊ";
+ Text[ dutch ] = "PBM-opties";
+ Text[ chinese_simplified ] = "PBM Ñ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò PBM";
+ Text[ korean ] = "PBM ¿É¼Ç";
+ Text[ turkish ] = "PBM seçenekleri";
+ Text[ language_user1 ] = " ";
+};
diff --git a/goodies/source/filter.vcl/epbm/epbm.cxx b/goodies/source/filter.vcl/epbm/epbm.cxx
new file mode 100644
index 000000000000..f6dc198be5bd
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/epbm.cxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * $RCSfile: epbm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+#include
+#include
+#include
+#include
+#include "strings.hrc"
+#include "dlgepbm.hrc"
+#include "dlgepbm.hxx"
+
+//============================ PBMWriter ==================================
+
+class PBMWriter {
+
+private:
+
+ PFilterCallback mpCallback;
+ void * mpCallerData;
+
+ SvStream* mpOStm; // Die auszugebende PBM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ UINT32 mnMode; // 0 -> raw, 1-> ascii
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+
+ BOOL ImplCallback( USHORT nPercent );
+ BOOL ImplWriteHeader();
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+
+public:
+ PBMWriter();
+ ~PBMWriter();
+
+ BOOL WritePBM( const Graphic& rGraphic, SvStream& rPBM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig );
+};
+
+//=================== Methoden von PBMWriter ==============================
+
+PBMWriter::PBMWriter() :
+ mpAcc ( NULL ),
+ mbStatus ( TRUE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PBMWriter::~PBMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PBMWriter::ImplCallback( USHORT nPercent )
+{
+ if ( mpCallback != NULL )
+ {
+ if ( ( (*mpCallback)( mpCallerData, nPercent ) ) == TRUE )
+ {
+ mpOStm->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PBMWriter::WritePBM( const Graphic& rGraphic, SvStream& rPBM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig )
+{
+
+ mpOStm = &rPBM;
+ mpCallback = pCallback;
+ mpCallerData = pCallerdata;
+
+ if ( pOptionsConfig )
+ {
+ mnMode = pOptionsConfig->ReadKey( "PBM-EXPORT-FORMAT", "0" ).ToInt32();
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ Bitmap aBmp = aBmpEx.GetBitmap();
+ aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ mpAcc = aBmp.AcquireReadAccess();
+ if( mpAcc )
+ {
+ if ( ImplWriteHeader() )
+ ImplWriteBody();
+
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PBMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight )
+ {
+ if ( mnMode == 0 )
+ *mpOStm << "P4\x0a";
+ else
+ *mpOStm << "P1\x0a";
+
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)10;
+ }
+ else mbStatus = FALSE;
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void PBMWriter::ImplWriteBody()
+{
+ if ( mnMode == 0 )
+ {
+ BYTE nBYTE;
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ ULONG x;
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ nBYTE <<= 1;
+ if (!(mpAcc->GetPixel( y, x ) & 1 ) )
+ nBYTE++;
+ if ( ( x & 7 ) == 7 )
+ *mpOStm << nBYTE;
+ }
+ if ( ( x & 7 ) != 0 )
+ *mpOStm << (BYTE)( nBYTE << ( ( x ^ 7 ) + 1 ) );
+ }
+ }
+ else
+ {
+ int nxCount;
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ nxCount = 70;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ if (!( --nxCount ) )
+ {
+ nxCount = 69;
+ *mpOStm << (BYTE)10;
+ }
+ *mpOStm << (BYTE)( ( mpAcc->GetPixel( y, x ) ^ 1 ) + '0' ) ;
+ }
+ *mpOStm << (BYTE)10;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void PBMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int32 n = 0, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig, BOOL )
+{
+ PBMWriter aPBMWriter;
+
+ return aPBMWriter.WritePBM( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow && rPara.pCfg )
+ {
+ ByteString aResMgrName( "epb" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPBM( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+#pragma hdrstop
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/epbm/epbmstr.src b/goodies/source/filter.vcl/epbm/epbmstr.src
new file mode 100644
index 000000000000..e40d72c97529
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/epbmstr.src
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: epbmstr.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_FORMAT
+{
+ Text = "PBM-EXPORT-FORMAT";
+};
diff --git a/goodies/source/filter.vcl/epbm/makefile.mk b/goodies/source/filter.vcl/epbm/makefile.mk
new file mode 100644
index 000000000000..ad67f60e1d66
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/makefile.mk
@@ -0,0 +1,184 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=epbm
+TARGET2=epb
+DEPTARGET=vepbm
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRCFILES= dlgepbm.src \
+ epbmstr.src
+
+SLOFILES = $(SLO)$/epbm.obj \
+ $(SLO)$/dlgepbm.obj
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+
+SHL1TARGET= epb$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= epbm
+SHL1STDLIBS= $(TOOLSLIB) \
+ $(SVLIB) \
+ $(CPPULIB) \
+ $(SVTOOLLIB)
+
+SHL1DEPN= $(LB)$/epbm.lib
+SHL1LIBS= $(SLB)$/epbm.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/epbm.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+ @echo _DoExportDialog >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).DLL >>$@
+ @ldump -E1 -A $(SLB)$/epbm.lib >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/epbm/strings.hrc b/goodies/source/filter.vcl/epbm/strings.hrc
new file mode 100644
index 000000000000..5a1e869a47dc
--- /dev/null
+++ b/goodies/source/filter.vcl/epbm/strings.hrc
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define KEY_FORMAT 256
diff --git a/goodies/source/filter.vcl/epgm/dlgepgm.cxx b/goodies/source/filter.vcl/epgm/dlgepgm.cxx
new file mode 100644
index 000000000000..19a500dbf95e
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/dlgepgm.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepgm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+#include
+#include
+#include
+#include "dlgepgm.hxx"
+#include "dlgepgm.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPGM::DlgExportEPGM( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPGM, rPara.pResMgr ) ),
+ aGrpFormat ( this, ResId( GRP_FORMAT ) ),
+ aRBRaw ( this, ResId( RB_RAW ) ),
+ aRBASCII ( this, ResId( RB_ASCII ) ),
+ 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
+
+ String aFormatStr( ResId( KEY_FORMAT, pMgr ) );
+ sal_Int32 nFormat = pConfig->ReadKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+
+ BOOL bCheck = FALSE;
+ if ( !nFormat )
+ bCheck ^= TRUE;
+ aRBRaw.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBASCII.Check( bCheck );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPGM, OK ) );
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPGM, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+ sal_Int32 nCheck = 0;
+ if ( aRBASCII.IsChecked() )
+ nCheck++;
+ String aFormatStr( ResId( KEY_FORMAT, pMgr ) );
+ pConfig->WriteKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
diff --git a/goodies/source/filter.vcl/epgm/dlgepgm.hrc b/goodies/source/filter.vcl/epgm/dlgepgm.hrc
new file mode 100644
index 000000000000..c582fdd8b2db
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/dlgepgm.hrc
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepgm.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "goodies.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_FORMAT 1
+#define RB_RAW 1
+#define RB_ASCII 2
diff --git a/goodies/source/filter.vcl/epgm/dlgepgm.hxx b/goodies/source/filter.vcl/epgm/dlgepgm.hxx
new file mode 100644
index 000000000000..4cfd937f33da
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/dlgepgm.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepgm.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DLGEPGM_HXX_
+#define _DLGEPGM_HXX_
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class Config;
+class ResMgr;
+
+class DlgExportEPGM : public ModalDialog
+{
+private:
+ GroupBox aGrpFormat;
+ RadioButton aRBRaw;
+ RadioButton aRBASCII;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEPGM( FltCallDialogParameter& rPara );
+};
+
+#endif // _DLGEPGM_HXX_
diff --git a/goodies/source/filter.vcl/epgm/dlgepgm.src b/goodies/source/filter.vcl/epgm/dlgepgm.src
new file mode 100644
index 000000000000..c5d5bd63797b
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/dlgepgm.src
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepgm.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "dlgepgm.hrc"
+ModalDialog DLG_EXPORT_EPGM
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 133 , 67 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text = "PGM Optionen" ;
+ Text [ ENGLISH ] = "PGM options" ;
+ Text [ english_us ] = "PGM Options" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 73 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 73 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 73 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ GroupBox GRP_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 54 ) ;
+ Text = "Datei Format" ;
+ Text [ ENGLISH ] = "file format" ;
+ Text[ italian ] = "Formato file";
+ Text[ portuguese_brazilian ] = "Datei Format";
+ Text[ portuguese ] = "Formato do ficheiro";
+ Text[ danish ] = "Filformat";
+ Text[ french ] = "Format de fichier";
+ Text[ swedish ] = "Filformat";
+ Text[ dutch ] = "Bestandsformaat";
+ Text[ spanish ] = "Formato de archivo";
+ Text[ english_us ] = "File format";
+ Text[ chinese_simplified ] = "Îļþ¸ñʽ";
+ Text[ russian ] = "Ôîðìàò ôàéëà";
+ Text[ polish ] = "Format pliku";
+ Text[ japanese ] = "̧²Ù‚Ì‘Ž®";
+ Text[ chinese_traditional ] = "Àɮ׮榡";
+ Text[ arabic ] = "ÊäÓíÞ ÇáãáÝ";
+ Text[ dutch ] = "Bestandsformaat";
+ Text[ chinese_simplified ] = "Îļþ¸ñʽ";
+ Text[ greek ] = "ÌïñöÞ áñ÷åßïõ";
+ Text[ korean ] = "ÆÄÀÏ ¼½Ä";
+ Text[ turkish ] = "Dosya formatý";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_RAW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Binär" ;
+ Text [ ENGLISH ] = "~raw" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Binario";
+ Text[ portuguese_brazilian ] = "~Binär";
+ Text[ portuguese ] = "~Binário";
+ Text[ danish ] = "~Binær";
+ Text[ french ] = "~Binaire";
+ Text[ swedish ] = "~Binär";
+ Text[ dutch ] = "~Binair";
+ Text[ spanish ] = "~Binario";
+ Text[ english_us ] = "~Binary";
+ Text[ chinese_simplified ] = "¶þÔª(~B)";
+ Text[ russian ] = "Áèíàðíûé";
+ Text[ polish ] = "Binarny";
+ Text[ japanese ] = "ÊÞ²ÅØ(~B)";
+ Text[ language_user1 ] = " ";
+ Text[ chinese_traditional ] = "¤G¦ì¤¸(~B)";
+ Text[ arabic ] = "ËäÇÆí";
+ Text[ dutch ] = "~Binair";
+ Text[ chinese_simplified ] = "¶þÔª(~B)";
+ Text[ greek ] = "Äõáäéêü";
+ Text[ korean ] = "¹ÙÀ̳ʸ®(~B)";
+ Text[ turkish ] = "Ýkili";
+ };
+ RadioButton RB_ASCII
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Text" ;
+ Text [ ENGLISH ] = "~text" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Testo";
+ Text[ portuguese_brazilian ] = "~Text";
+ Text[ portuguese ] = "~Texto";
+ Text[ danish ] = "~Tekst";
+ Text[ french ] = "~Texte";
+ Text[ swedish ] = "~Text";
+ Text[ dutch ] = "~Tekst";
+ Text[ spanish ] = "~Texto";
+ Text[ english_us ] = "~Text";
+ Text[ chinese_simplified ] = "ÎÄ×Ö(~T)";
+ Text[ russian ] = "Òåêñò";
+ Text[ polish ] = "Tekst";
+ Text[ japanese ] = "÷½Ä(~T)";
+ Text[ chinese_traditional ] = "¤å¦r(~T)";
+ Text[ arabic ] = "ÇáäÕ";
+ Text[ dutch ] = "~Tekst";
+ Text[ chinese_simplified ] = "ÎÄ×Ö(~T)";
+ Text[ greek ] = "Êåßìåíï";
+ Text[ korean ] = "ÅؽºÆ®(~T)";
+ Text[ turkish ] = "Metin";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ italian ] = "Opzioni PGM";
+ Text[ portuguese_brazilian ] = "PGM Optionen";
+ Text[ portuguese ] = "Opções PGM";
+ Text[ danish ] = "PGM indstillinger";
+ Text[ french ] = "Options PGM";
+ Text[ swedish ] = "PGM alternativ";
+ Text[ dutch ] = "PGM-opties";
+ Text[ spanish ] = "Opciones PGM";
+ Text[ chinese_simplified ] = "PGM Ñ¡Ïî";
+ Text[ russian ] = "Ïàðàìåòðû PGM";
+ Text[ polish ] = "Opcje PGM";
+ Text[ japanese ] = "PGM µÌß¼®Ý";
+ Text[ chinese_traditional ] = "PGM¿ï¶µ";
+ Text[ arabic ] = "PGM ÎíÇÑÇÊ";
+ Text[ dutch ] = "PGM-opties";
+ Text[ chinese_simplified ] = "PGM Ñ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò PGM";
+ Text[ korean ] = "PGM ¿É¼Ç";
+ Text[ turkish ] = "PGM seçenekleri";
+ Text[ language_user1 ] = " ";
+};
diff --git a/goodies/source/filter.vcl/epgm/epgm.cxx b/goodies/source/filter.vcl/epgm/epgm.cxx
new file mode 100644
index 000000000000..44cd6b6b9b2c
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/epgm.cxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * $RCSfile: epgm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+#include
+#include
+#include
+#include
+#include "strings.hrc"
+#include "dlgepgm.hrc"
+#include "dlgepgm.hxx"
+
+//============================ PGMWriter ==================================
+
+class PGMWriter {
+
+private:
+
+ PFilterCallback mpCallback;
+ void * mpCallerData;
+
+ SvStream* mpOStm; // Die auszugebende PGM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ UINT32 mnMode;
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+
+ BOOL ImplCallback( USHORT nPercent );
+ BOOL ImplWriteHeader();
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+
+public:
+ PGMWriter();
+ ~PGMWriter();
+
+ BOOL WritePGM( const Graphic& rGraphic, SvStream& rPGM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig );
+};
+
+//=================== Methoden von PGMWriter ==============================
+
+PGMWriter::PGMWriter() :
+ mpAcc ( NULL ),
+ mbStatus ( TRUE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PGMWriter::~PGMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PGMWriter::ImplCallback( USHORT nPercent )
+{
+ if ( mpCallback != NULL )
+ {
+ if ( ( (*mpCallback)( mpCallerData, nPercent ) ) == TRUE )
+ {
+ mpOStm->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PGMWriter::WritePGM( const Graphic& rGraphic, SvStream& rPGM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig )
+{
+
+ mpOStm = &rPGM;
+ mpCallback = pCallback;
+ mpCallerData = pCallerdata;
+
+ if ( pOptionsConfig )
+ {
+ mnMode = pOptionsConfig->ReadKey( "PGM-EXPORT-FORMAT", "0" ).ToInt32();
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ Bitmap aBmp = aBmpEx.GetBitmap();
+ aBmp.Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ mpAcc = aBmp.AcquireReadAccess();
+ if( mpAcc )
+ {
+ if ( ImplWriteHeader() )
+ {
+ ImplWriteBody();
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PGMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight )
+ {
+ if ( mnMode == 0 )
+ *mpOStm << "P5\x0a";
+ else
+ *mpOStm << "P2\x0a";
+
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( 255 ); // max. gray value
+ *mpOStm << (BYTE)10;
+ }
+ else
+ mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void PGMWriter::ImplWriteBody()
+{
+ if ( mnMode == 0 )
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ *mpOStm << (BYTE)( mpAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ else
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ int nCount = 70;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ BYTE nDat, nNumb;
+ if ( nCount < 0 )
+ {
+ nCount = 69;
+ *mpOStm << (BYTE)10;
+ }
+ nDat = (BYTE)mpAcc->GetPixel( y, x );
+ if ( ( nNumb = nDat / 100 ) )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat -= ( nNumb * 100 );
+ nNumb = nDat / 10;
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat + '0' );
+ nCount -= 4;
+ }
+ else if ( ( nNumb = nDat / 10 ) )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat + '0' );
+ nCount -= 3;
+ }
+ else
+ {
+ *mpOStm << (BYTE)( nDat + '0' );
+ nCount -= 2;
+ }
+ *mpOStm << (BYTE)' ';
+ }
+ *mpOStm << (BYTE)10;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void PGMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int32 n = 0UL, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig, BOOL )
+{
+ PGMWriter aPGMWriter;
+
+ return aPGMWriter.WritePGM( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow && rPara.pCfg )
+ {
+ ByteString aResMgrName( "epg" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPGM( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+#pragma hdrstop
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/epgm/epgmstr.src b/goodies/source/filter.vcl/epgm/epgmstr.src
new file mode 100644
index 000000000000..921b45734449
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/epgmstr.src
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: epgmstr.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_FORMAT
+{
+ Text = "PGM-EXPORT-FORMAT";
+};
diff --git a/goodies/source/filter.vcl/epgm/makefile.mk b/goodies/source/filter.vcl/epgm/makefile.mk
new file mode 100644
index 000000000000..9fe3d54d5aae
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/makefile.mk
@@ -0,0 +1,185 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=epgm
+TARGET2=epg
+DEPTARGET=vepgm
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRCFILES= dlgepgm.src \
+ epgmstr.src
+
+SLOFILES = $(SLO)$/epgm.obj \
+ $(SLO)$/dlgepgm.obj
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+
+SHL1TARGET= epg$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= epgm
+SHL1STDLIBS= $(TOOLSLIB) \
+ $(SVLIB) \
+ $(CPPULIB) \
+ $(SVTOOLLIB)
+
+SHL1DEPN= $(LB)$/epgm.lib
+SHL1LIBS= $(SLB)$/epgm.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/epgm.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+ @echo _DoExportDialog >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).DLL >>$@
+ @ldump -E1 -A $(SLB)$/epgm.lib >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/epgm/strings.hrc b/goodies/source/filter.vcl/epgm/strings.hrc
new file mode 100644
index 000000000000..5a1e869a47dc
--- /dev/null
+++ b/goodies/source/filter.vcl/epgm/strings.hrc
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define KEY_FORMAT 256
diff --git a/goodies/source/filter.vcl/epict/dlgepct.cxx b/goodies/source/filter.vcl/epict/dlgepct.cxx
new file mode 100644
index 000000000000..8b89d8871d3e
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/dlgepct.cxx
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepct.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include
+#include
+#include "dlgepct.hxx"
+#include "dlgepct.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPCT::DlgExportEPCT( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPCT, rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, ResId( BTN_HELP ) ),
+ aRbOriginal ( this, ResId( RB_ORIGINAL ) ),
+ aRbSize ( this, ResId( RB_SIZE ) ),
+ aGrpMode ( this, ResId( GRP_MODE ) ),
+ aFtSizeX ( this, ResId( FT_SIZEX ) ),
+ aMtfSizeX ( this, ResId( MTF_SIZEX ) ),
+ aFtSizeY ( this, ResId( FT_SIZEY ) ),
+ aMtfSizeY ( this, ResId( MTF_SIZEY ) ),
+ aGrpSize ( this, ResId( GRP_SIZE ) ),
+ pConfig ( rPara.pCfg ),
+ pMgr ( rPara.pResMgr )
+
+{
+ FreeResource();
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPCT, OK ) );
+ aRbOriginal.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbOriginal ) );
+ aRbSize.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbSize ) );
+
+ // Config-Parameter lesen
+ String aMStr( ResId( KEY_MODE, pMgr ) );
+ String aSXStr( ResId( KEY_SIZEX, pMgr ) );
+ String aSYStr( ResId( KEY_SIZEY, pMgr ) );
+
+ sal_Int32 nStrMode( pConfig->ReadKey( ByteString( aMStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32() );
+ ByteString aStrSizeX( pConfig->ReadKey( ByteString( aSXStr, RTL_TEXTENCODING_UTF8 ) ) );
+ ByteString aStrSizeY( pConfig->ReadKey( ByteString( aSYStr, 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;
+ }
+
+ if ( nStrMode == 1 )
+ {
+ aRbSize.Check( TRUE );
+ ClickRbSize( NULL );
+ }
+ else
+ {
+ aRbOriginal.Check( TRUE );
+ ClickRbOriginal( NULL );
+ }
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\**************************************** ********************************/
+
+IMPL_LINK( DlgExportEPCT, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ sal_Int32 nSizeX = (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM );
+ sal_Int32 nSizeY = (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM );
+ sal_Int32 nStrMode;
+
+ if ( aRbSize.IsChecked() )
+ nStrMode = 1;
+ else
+ nStrMode = 0;
+
+ String aMStr( ResId( KEY_MODE, pMgr ) );
+ String aSXStr( ResId( KEY_SIZEX, pMgr ) );
+ String aSYStr( ResId( KEY_SIZEY, pMgr ) );
+ pConfig->WriteKey( ByteString( aMStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nStrMode ) );
+ pConfig->WriteKey( ByteString( aSXStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nSizeX ) );
+ pConfig->WriteKey( ByteString( aSYStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nSizeY ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPCT, ClickRbOriginal, void*, EMPTYARG )
+{
+ aGrpSize.Disable();
+ aFtSizeX.Disable();
+ aMtfSizeX.Disable();
+ aFtSizeY.Disable();
+ aMtfSizeY.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPCT, ClickRbSize, void*, EMPTYARG )
+{
+ aGrpSize.Enable();
+ aFtSizeX.Enable();
+ aMtfSizeX.Enable();
+ aFtSizeY.Enable();
+ aMtfSizeY.Enable();
+
+ return 0;
+}
+
+
+
diff --git a/goodies/source/filter.vcl/epict/dlgepct.hrc b/goodies/source/filter.vcl/epict/dlgepct.hrc
new file mode 100644
index 000000000000..e424f2b56ec8
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/dlgepct.hrc
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepct.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define CBX_SIZE 2
+#define MTF_SIZEX 1
+#define MTF_SIZEY 2
+#define FT_SIZEX 1
+#define FT_SIZEY 2
+#define GRP_SIZE 1
+#define GRP_MODE 2
+#define RB_ORIGINAL 1
+#define RB_SIZE 2
+
diff --git a/goodies/source/filter.vcl/epict/dlgepct.hxx b/goodies/source/filter.vcl/epict/dlgepct.hxx
new file mode 100644
index 000000000000..79df32b3aab9
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/dlgepct.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepct.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DLGEPCT_HXX_
+#define _DLGEPCT_HXX_
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten
+|*
+\************************************************************************/
+
+class Config;
+class ResMgr;
+
+class DlgExportEPCT : 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;
+
+ DECL_LINK( OK, void* p );
+ DECL_LINK( ClickRbOriginal,void* p );
+ DECL_LINK( ClickRbSize,void* p );
+
+public:
+ DlgExportEPCT( FltCallDialogParameter& rPara );
+};
+
+#endif // _DLGEPCT_HXX_
+
diff --git a/goodies/source/filter.vcl/epict/dlgepct.src b/goodies/source/filter.vcl/epict/dlgepct.src
new file mode 100644
index 000000000000..6a20a7134336
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/dlgepct.src
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgepct.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "dlgepct.hrc"
+
+ModalDialog DLG_EXPORT_EPCT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 178 , 98 ) ;
+ Text = "PICT Optionen" ;
+ Text [ ENGLISH ] = "PICT options" ;
+ Text [ english_us ] = "PICT Options" ;
+ Text [ italian ] = "Opzioni PICT" ;
+ Text [ spanish ] = "Opciones PICT" ;
+ Text [ french ] = "Options PICT" ;
+ Text [ dutch ] = "PICT-opties" ;
+ Text [ swedish ] = "PICT alternativ" ;
+ Text [ danish ] = "PICT indstillinger" ;
+ Text [ portuguese_brazilian ] = "PICT Optionen" ;
+ Text [ portuguese ] = "Opções PICT" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ MetricField MTF_SIZEX
+ {
+ 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
+ {
+ 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
+ {
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 110 , 44 ) ;
+ Text = "Größe" ;
+ Text [ ENGLISH ] = "Size" ;
+ Text [ english_us ] = "Size" ;
+ Text [ dutch ] = "Grootte" ;
+ Text [ italian ] = "Dimens." ;
+ Text [ spanish ] = "Tamaño" ;
+ Text [ french ] = "Taille" ;
+ Text [ swedish ] = "Storlek" ;
+ Text [ danish ] = "Størrelse" ;
+ Text [ portuguese ] = "Tamanho" ;
+ Text [ portuguese_brazilian ] = "Tamanho" ;
+ Text[ chinese_simplified ] = "´óС";
+ Text[ russian ] = "Ðàçìåð";
+ Text[ polish ] = "Rozmiar";
+ Text[ japanese ] = "»²½Þ";
+ Text[ chinese_traditional ] = "¤j¤p";
+ Text[ arabic ] = "ÇáÍÌã";
+ Text[ dutch ] = "Grootte";
+ Text[ chinese_simplified ] = "´óС";
+ Text[ greek ] = "ÌÝãåèïò";
+ Text[ korean ] = "Å©±â";
+ Text[ turkish ] = "Boyut";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SIZEX
+ {
+ 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 ] = "Largura" ;
+ Text[ chinese_simplified ] = "¿í¶È";
+ Text[ russian ] = "Øèðèíà";
+ Text[ polish ] = "Szer.";
+ Text[ japanese ] = "•";
+ Text[ chinese_traditional ] = "¼e«×";
+ Text[ arabic ] = "ÇáÚÑÖ";
+ Text[ dutch ] = "Breedte";
+ Text[ chinese_simplified ] = "¿í¶È";
+ Text[ greek ] = "ÐëÜôïò";
+ Text[ korean ] = "³Êºñ";
+ Text[ turkish ] = "Geniþlik";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SIZEY
+ {
+ 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øjde" ;
+ Text [ portuguese ] = "Altura" ;
+ Text[ chinese_simplified ] = "¸ß¶È";
+ Text[ russian ] = "Âûñîòà";
+ Text[ polish ] = "Wys.";
+ Text[ japanese ] = "‚‚³";
+ Text[ chinese_traditional ] = "°ª«×";
+ Text[ arabic ] = "ÇáÇÑÊÝÇÚ";
+ Text[ dutch ] = "Hoogte";
+ Text[ chinese_simplified ] = "¸ß¶È";
+ Text[ greek ] = "¾øïò";
+ Text[ korean ] = "³ôÀÌ";
+ Text[ turkish ] = "Yükseklik";
+ Text[ language_user1 ] = " ";
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 122 , 24 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 122 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_ORIGINAL
+ {
+ Pos = MAP_APPFONT ( 12 , 12 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "~Original" ;
+ Text [ ENGLISH ] = "~Original" ;
+ 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[ dutch ] = "~Origineel";
+ Text[ chinese_simplified ] = "Ô¼þ(~O)";
+ Text[ greek ] = "Áñ÷éêü";
+ Text[ korean ] = "¿À¸®Áö³Î(~O)";
+ Text[ turkish ] = "Aslý";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_SIZE
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "~Größe" ;
+ Text [ ENGLISH ] = "~Size" ;
+ Text [ dutch ] = "~Grootte" ;
+ Text [ english_us ] = "~Size" ;
+ Text [ italian ] = "~Dimens." ;
+ Text [ spanish ] = "~Tamaño" ;
+ Text [ french ] = "~Taille" ;
+ Text [ swedish ] = "~Storlek" ;
+ Text [ danish ] = "~Størrelse" ;
+ Text [ portuguese ] = "~Tamanho" ;
+ Text [ portuguese_brazilian ] = "~Tamanho" ;
+ Text[ chinese_simplified ] = "´óС(~S)";
+ Text[ russian ] = "Ðàçìåð";
+ Text[ polish ] = "Rozmiar";
+ Text[ japanese ] = "»²½Þ(~S)";
+ Text[ chinese_traditional ] = "¤j¤p(~S)";
+ Text[ arabic ] = "ÇáÍÌã";
+ Text[ dutch ] = "~Grootte";
+ Text[ chinese_simplified ] = "´óС(~S)";
+ Text[ greek ] = "ÌÝãåèïò";
+ Text[ korean ] = "Å©±â(~S)";
+ Text[ turkish ] = "Boyut";
+ Text[ language_user1 ] = " ";
+ };
+ GroupBox GRP_MODE
+ {
+ 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[ dutch ] = "Modus";
+ Text[ chinese_simplified ] = "ģʽ";
+ Text[ greek ] = "ÊáôÜóôáóç";
+ Text[ korean ] = "¸ðµå";
+ Text[ turkish ] = "Kip";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ chinese_simplified ] = "PICT Ñ¡Ïî";
+ Text[ russian ] = "Ïàðàìåòðû PICT";
+ Text[ polish ] = "Opcje PICT";
+ Text[ japanese ] = "PICT µÌß¼®Ý";
+ Text[ chinese_traditional ] = "PICT¿ï¶µ";
+ Text[ arabic ] = "PICT ÎíÇÑÇÊ";
+ Text[ dutch ] = "PICT-opties";
+ Text[ chinese_simplified ] = "PICT Ñ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò PICT";
+ Text[ korean ] = "PICT ¿É¼Ç";
+ Text[ turkish ] = "PICT seçenekleri";
+ Text[ language_user1 ] = " ";
+};
diff --git a/goodies/source/filter.vcl/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx
new file mode 100644
index 000000000000..7e424939c8cd
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/epict.cxx
@@ -0,0 +1,2313 @@
+/*************************************************************************
+ *
+ * $RCSfile: epict.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if SUPD <= 364
+#include
+#include
+#include
+#else
+#include
+#include
+#include
+#include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "strings.hrc"
+#include "dlgepct.hrc"
+#include "dlgepct.hxx"
+
+//============================== PictWriter ===================================
+
+struct PictWriterAttrStackMember {
+ struct PictWriterAttrStackMember * pSucc;
+ Color aLineColor;
+ Color aFillColor;
+ RasterOp eRasterOp;
+ Font aFont;
+ MapMode aMapMode;
+};
+
+
+enum PictDrawingMethod {
+ PDM_FRAME, PDM_PAINT, PDM_ERASE, PDM_INVERT, PDM_FILL
+};
+
+
+struct PictPattern {
+ ULONG nLo, nHi;
+};
+
+
+class PictWriter {
+
+private:
+
+ BOOL bStatus;
+
+ PFilterCallback pCallback;
+ void * pCallerData;
+ ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
+
+ SvStream * pPict;
+
+ // Aktuelle Attribute im Quell-Metafile:
+ Color aLineColor;
+ Color aFillColor;
+ RasterOp eSrcRasterOp;
+ Font aSrcFont;
+ MapMode aSrcMapMode;
+ MapMode aTargetMapMode;
+ PictWriterAttrStackMember * pAttrStack;
+
+ // Aktuelle Attribute im Ziel-Metafile, und ob sie gueltig sind
+ BOOL bDstBkPatVisible; BOOL bDstBkPatValid;
+ BYTE nDstTxFace; BOOL bDstTxFaceValid;
+ RasterOp eDstTxMode; BOOL bDstTxModeValid;
+ USHORT nDstPnSize; BOOL bDstPnSizeValid;
+ RasterOp eDstPnMode; BOOL bDstPnModeValid;
+ PictPattern aDstPnPat; BOOL bDstPnPatValid;
+ BOOL bDstFillPatVisible; BOOL bDstFillPatValid;
+ USHORT nDstTxSize; BOOL bDstTxSizeValid;
+ Color aDstFgCol; BOOL bDstFgColValid;
+ Color aDstBkCol; BOOL bDstBkColValid;
+ Point aDstPenPosition; BOOL bDstPenPositionValid;
+ Point aDstTextPosition; BOOL bDstTextPositionValid;
+ String aDstFontName; USHORT nDstFontNameId; BOOL bDstFontNameValid;
+
+ ULONG nNumberOfActions; // Anzahl der Actions im GDIMetafile
+ ULONG nNumberOfBitmaps; // Anzahl der Bitmaps
+ ULONG nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Opcodes
+ 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)
+
+ Polygon PolyPolygonToPolygon(const PolyPolygon & rPoly);
+ // Macht aus einem PolyPolygon ein halbwegs vernuenftiges Polygon
+
+ void WritePoint(const Point & rPoint);
+ void WriteSize(const Size & rSize);
+ void WriteRGBColor(const Color & rColor);
+ void WriteString( const ByteString & rString );
+ void WriteRectangle(const Rectangle & rRect);
+ void WritePolygon(const Polygon & rPoly);
+ void WriteArcAngles(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
+
+ void ConvertLinePattern(PictPattern & rPat, BOOL bVisible);
+ void ConvertFillPattern(PictPattern & rPat, BOOL bVisible);
+
+ void WriteOpcode_BkPat(BOOL bVisible);
+ void WriteOpcode_TxFace(const Font & rFont);
+ void WriteOpcode_TxMode(RasterOp eMode);
+ void WriteOpcode_PnSize(USHORT nSize);
+ void WriteOpcode_PnMode(RasterOp eMode);
+ void WriteOpcode_PnLinePat(BOOL bVisible);
+ void WriteOpcode_PnFillPat(BOOL bVisible);
+ void WriteOpcode_FillPat(BOOL bVisible);
+ void WriteOpcode_OvSize(const Size & rSize);
+ void WriteOpcode_TxSize(USHORT nSize);
+ void WriteOpcode_RGBFgCol(const Color & rColor);
+ void WriteOpcode_RGBBkCol(const Color & rColor);
+ void WriteOpcode_Line(const Point & rLocPt, const Point & rNewPt);
+ void WriteOpcode_LineFrom(const Point & rNewPt);
+ void WriteOpcode_Text(const Point & rPoint, const ByteString& rString, BOOL bDelta);
+ void WriteOpcode_FontName(const Font & rFont);
+ void WriteOpcode_Rect(PictDrawingMethod eMethod, const Rectangle & rRect);
+ void WriteOpcode_SameRect(PictDrawingMethod eMethod);
+ void WriteOpcode_RRect(PictDrawingMethod eMethod, const Rectangle & rRect);
+ void WriteOpcode_SameRRect(PictDrawingMethod eMethod);
+ void WriteOpcode_Oval(PictDrawingMethod eMethod, const Rectangle & rRect);
+ void WriteOpcode_SameOval(PictDrawingMethod eMethod);
+ void WriteOpcode_Arc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt);
+ void WriteOpcode_SameArc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt);
+ void WriteOpcode_Poly(PictDrawingMethod eMethod, const Polygon & rPoly);
+ void WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap);
+ void WriteOpcode_EndOfFile();
+
+ void SetAttrForPaint();
+ void SetAttrForFrame();
+ void SetAttrForText();
+
+ void WriteTextArray(Point & rPoint, const ByteString& rString, const long * pDXAry);
+
+ void WriteOpcodes(const GDIMetaFile & rMTF);
+
+ void WriteHeader(const GDIMetaFile & rMTF);
+ void UpdateHeader();
+
+public:
+
+ BOOL WritePict(const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ PFilterCallback pcallback, void * pcallerdata);
+};
+
+
+//========================== Methoden von PictWriter ==========================
+
+
+void PictWriter::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 PictWriter::CountActionsAndBitmaps(const GDIMetaFile & rMTF)
+{
+ ULONG nAction, nActionCount;
+ const MetaAction* pMA;
+
+ nActionCount = rMTF.GetActionCount();
+
+ for (nAction=0; nActionGetType() )
+ {
+ 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++;
+ }
+}
+
+
+Polygon PictWriter::PolyPolygonToPolygon(const PolyPolygon & rPolyPoly)
+{
+ USHORT nCount,nSize1,nSize2,np,i1,i2,i3,nBestIdx1,nBestIdx2;
+ long nDistSqr,nBestDistSqr, nCountdownTests;
+ Point aP1,aPRel;
+ Polygon aPoly1, aPoly2, aPoly3;
+
+ nCount=rPolyPoly.Count();
+ if (nCount==0) return Polygon(0);
+
+ aPoly1=rPolyPoly.GetObject(0);
+ for (np=1; np 255 )
+ nLen = 255;
+ *pPict << ( (BYTE)nLen );
+ for ( i = 0; i < nLen; i++ )
+ *pPict << rString.GetChar( i );
+}
+
+
+void PictWriter::WriteRectangle(const Rectangle & rRect)
+{
+ Point aPoint = OutputDevice::LogicToLogic( rRect.TopLeft(),
+ aSrcMapMode,
+ aTargetMapMode );
+ Size aSize = OutputDevice::LogicToLogic( rRect.GetSize(),
+ aSrcMapMode,
+ aTargetMapMode );
+ Rectangle aRect( aPoint, aSize );
+
+
+ short x1,y1,x2,y2,t;
+
+ x1=(short) aRect.Left();
+ y1=(short) aRect.Top();
+ x2=(short) aRect.Right();
+ y2=(short) aRect.Bottom();
+ if (x1>x2) { t=x1; x1=x2; x2=t; }
+ if (y1>y2) { t=y1; y1=y2; y2=t; }
+ x2++;
+ y2++;
+ *pPict << y1 << x1 << y2 << x2;
+}
+
+
+void PictWriter::WritePolygon(const Polygon & rPoly)
+{
+ USHORT nDataSize,i,nSize;
+ short nMinX,nMinY,nMaxX,nMaxY,nx,ny;
+ Polygon aPoly(rPoly);
+
+ nSize=aPoly.GetSize();
+
+ if (aPoly.GetPoint(0) != aPoly.GetPoint(nSize-1))
+ {
+ nSize++;
+ aPoly.SetSize(nSize);
+ aPoly.SetPoint(aPoly.GetPoint(0),nSize-1);
+ }
+
+ nDataSize=nSize*4+10;
+ for (i=0; inx )
+ nMinX=nx;
+ if ( i==0 || nMinY>ny )
+ nMinY=ny;
+ if ( i==0 || nMaxX> 1,
+ ( aRect.Top() + aRect.Bottom() ) >> 1 );
+
+ fdx=(double)(aStartPt.X()-aCenter.X());
+ fdy=(double)(aStartPt.Y()-aCenter.Y());
+ if ( fdx==0.0 && fdy==0.0 )
+ fdx=1.0;
+ fAngE=atan2(fdx,-fdy);
+
+ fdx=(double)(aEndPt.X()-aCenter.X());
+ fdy=(double)(aEndPt.Y()-aCenter.Y());
+ if ( fdx==0.0 && fdy==0.0 )
+ fdx=1.0;
+ fAngS=atan2(fdx,-fdy);
+
+ nStartAngle=(short)(fAngS*180.0/3.14159265359);
+ nArcAngle=((short)(fAngE*180.0/3.14159265359))-nStartAngle;
+ if (nArcAngle<0)
+ nArcAngle += 360;
+ *pPict << nStartAngle << nArcAngle;
+}
+
+
+void PictWriter::ConvertLinePattern(PictPattern & rPat, BOOL bVisible)
+{
+ if( bVisible )
+ {
+ rPat.nHi=0xffffffff;
+ rPat.nLo=0xffffffff;
+ }
+ else
+ {
+ rPat.nHi=0x00000000;
+ rPat.nLo=0x00000000;
+ }
+}
+
+void PictWriter::ConvertFillPattern(PictPattern & rPat, BOOL bVisible)
+{
+ if( bVisible )
+ {
+ rPat.nHi=0xffffffff;
+ rPat.nLo=0xffffffff;
+ }
+ else
+ {
+ rPat.nHi=0x00000000;
+ rPat.nLo=0x00000000;
+ }
+}
+
+
+void PictWriter::WriteOpcode_BkPat(BOOL bVisible)
+{
+ if (bDstBkPatValid==FALSE || bDstBkPatVisible!=bVisible) {
+ PictPattern aPat;
+ ConvertFillPattern(aPat,bVisible);
+ *pPict << (USHORT)0x0002 << aPat.nHi << aPat.nLo;
+ bDstBkPatVisible=bVisible;
+ bDstBkPatValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_TxFace(const Font & rFont)
+{
+ BYTE nFace;
+ FontWeight eWeight;
+
+ nFace=0;
+ eWeight=rFont.GetWeight();
+ if (eWeight==WEIGHT_BOLD ||
+ eWeight==WEIGHT_SEMIBOLD ||
+ eWeight==WEIGHT_ULTRABOLD ||
+ eWeight==WEIGHT_BLACK) nFace|=0x01;
+ if (rFont.GetItalic()!=ITALIC_NONE) nFace|=0x02;
+ if (rFont.GetUnderline()!=UNDERLINE_NONE) nFace|=0x04;
+ if (rFont.IsOutline()==TRUE) nFace|=0x08;
+ if (rFont.IsShadow()==TRUE) nFace|=0x10;
+
+ if (bDstTxFaceValid==FALSE || nDstTxFace!=nFace) {
+ *pPict << (USHORT)0x0004 << nFace << (BYTE)0;
+ nDstTxFace=nFace;
+ bDstTxFaceValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_TxMode(RasterOp eMode)
+{
+ USHORT nVal;
+
+ if (bDstTxModeValid==FALSE || eDstTxMode!=eMode) {
+ switch (eMode) {
+ case ROP_INVERT: nVal=0x000c; break;
+ case ROP_XOR: nVal=0x000a; break;
+ default: nVal=0x0008;
+ }
+ *pPict << (USHORT)0x0005 << nVal;
+ eDstTxMode=eMode;
+ bDstTxModeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnSize(USHORT nSize)
+{
+ if (nSize==0) nSize=1;
+ if (bDstPnSizeValid==FALSE || nDstPnSize!=nSize) {
+ *pPict << (USHORT)0x0007 << nSize << nSize;
+ nDstPnSize=nSize;
+ bDstPnSizeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnMode(RasterOp eMode)
+{
+ USHORT nVal;
+
+ if (bDstPnModeValid==FALSE || eDstPnMode!=eMode) {
+ switch (eMode)
+ {
+ case ROP_INVERT: nVal=0x000c; break;
+ case ROP_XOR: nVal=0x000a; break;
+ default: nVal=0x0008;
+ }
+ *pPict << (USHORT)0x0008 << nVal;
+ eDstPnMode=eMode;
+ bDstPnModeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnLinePat(BOOL bVisible)
+{
+ PictPattern aPat;
+
+ ConvertLinePattern(aPat,bVisible);
+ if (bDstPnPatValid==FALSE || aDstPnPat.nHi!=aPat.nHi || aDstPnPat.nLo!=aPat.nLo) {
+ *pPict << (USHORT)0x0009 << aPat.nHi << aPat.nLo;
+ aDstPnPat=aPat;
+ bDstPnPatValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_PnFillPat(BOOL bVisible)
+{
+ PictPattern aPat;
+
+ ConvertFillPattern(aPat,bVisible);
+ if (bDstPnPatValid==FALSE || aDstPnPat.nHi!=aPat.nHi || aDstPnPat.nLo!=aPat.nLo) {
+ *pPict << (USHORT)0x0009 << aPat.nHi << aPat.nLo;
+ aDstPnPat=aPat;
+ bDstPnPatValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_FillPat(BOOL bVisible)
+{
+ if (bDstFillPatValid==FALSE || bDstFillPatVisible!=bVisible) {
+ PictPattern aPat;
+ ConvertFillPattern(aPat,bVisible);
+ *pPict << (USHORT)0x000a << aPat.nHi << aPat.nLo;
+ bDstFillPatVisible=bVisible;
+ bDstFillPatValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_OvSize(const Size & rSize)
+{
+ *pPict << (USHORT)0x000b;
+ WriteSize(rSize);
+}
+
+
+void PictWriter::WriteOpcode_TxSize(USHORT nSize)
+{
+ if (bDstTxSizeValid==FALSE || nDstTxSize!=nSize) {
+
+ nDstTxSize = (USHORT) OutputDevice::LogicToLogic( Size( 0, nSize ),
+ aSrcMapMode, aTargetMapMode ).Height();
+
+ *pPict << (USHORT)0x000d << nDstTxSize;
+ bDstTxSizeValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_RGBFgCol(const Color & rColor)
+{
+ if (bDstFgColValid==FALSE || aDstFgCol!=rColor) {
+ *pPict << (USHORT)0x001a;
+ WriteRGBColor(rColor);
+ aDstFgCol=rColor;
+ bDstFgColValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_RGBBkCol(const Color & rColor)
+{
+ if (bDstBkColValid==FALSE || aDstBkCol!=rColor) {
+ *pPict << (USHORT)0x001b;
+ WriteRGBColor(rColor);
+ aDstBkCol=rColor;
+ bDstBkColValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_Line(const Point & rLocPt, const Point & rNewPt)
+{
+ Point aLocPt = OutputDevice::LogicToLogic( rLocPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ Point aNewPt = OutputDevice::LogicToLogic( rNewPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ long dh,dv;
+
+ dh=aNewPt.X()-aLocPt.X();
+ dv=aNewPt.Y()-aLocPt.Y();
+ if (dh<=127 && dh>=-128 && dv<=127 && dv>=-128)
+ { // ShortLine
+ *pPict << (USHORT)0x0022;
+ WritePoint(rLocPt);
+ *pPict << (char)dh << (char)dv;
+ }
+ else
+ {
+ *pPict << (USHORT)0x0020;
+ WritePoint(rLocPt);
+ WritePoint(rNewPt);
+ }
+ aDstPenPosition=rNewPt;
+ bDstPenPositionValid=TRUE;
+}
+
+
+void PictWriter::WriteOpcode_LineFrom(const Point & rNewPt)
+{
+ Point aNewPt = OutputDevice::LogicToLogic( rNewPt,
+ aSrcMapMode,
+ aTargetMapMode );
+ long dh,dv;
+
+ dh = aNewPt.X()-aDstPenPosition.X();
+ dv = aNewPt.Y()-aDstPenPosition.Y();
+
+ if (dh<=127 && dh>=-128 && dv<=127 && dv>=-128)
+ { // ShortLine
+ *pPict << (USHORT)0x0023;
+ *pPict << (char)dh << (char)dv;
+ }
+ else
+ {
+ *pPict << (USHORT)0x0021;
+ WritePoint(rNewPt);
+ }
+ aDstPenPosition=rNewPt;
+ bDstPenPositionValid=TRUE;
+}
+
+
+void PictWriter::WriteOpcode_Text(const Point & rPoint, const ByteString& rString, BOOL bDelta)
+{
+ Point aPoint = OutputDevice::LogicToLogic( rPoint,
+ aSrcMapMode,
+ aTargetMapMode );
+ long dh,dv;
+ ULONG nPos;
+
+ nPos = pPict->Tell();
+ dh = aPoint.X()-aDstTextPosition.X();
+ dv = aPoint.Y()-aDstTextPosition.Y();
+
+ if (bDstTextPositionValid==FALSE || dh<0 || dh>255 || dv<0 || dv>0 || bDelta==FALSE)
+ {
+ *pPict << (USHORT)0x0028;
+ WritePoint(rPoint);
+ }
+ else if (dv==0)
+ {
+ *pPict << (USHORT)0x0029 << (BYTE)dh;
+ }
+ else if (dh==0)
+ {
+ *pPict << (USHORT)0x002a << (BYTE)dv;
+ }
+ else
+ {
+ *pPict << (USHORT)0x002b << (BYTE)dh << (BYTE)dv;
+ }
+
+ WriteString( rString );
+ if (((pPict->Tell()-nPos)&1)!=0)
+ *pPict << (BYTE)0;
+
+ aDstTextPosition = aPoint;
+ bDstTextPositionValid=TRUE;
+}
+
+
+void PictWriter::WriteOpcode_FontName(const Font & rFont)
+{
+ USHORT nDataLen,nFontId;
+
+ switch (rFont.GetFamily()) {
+ case FAMILY_MODERN: nFontId=22; break;
+ case FAMILY_ROMAN: nFontId=20; break;
+ case FAMILY_SWISS: nFontId=21; break;
+ default: nFontId=1;
+ }
+
+ if (bDstFontNameValid==FALSE || nDstFontNameId!=nFontId || aDstFontName!=rFont.GetName()) {
+ if (rFont.GetName().Len()>0) {
+ nDataLen=3+rFont.GetName().Len();
+ *pPict << (USHORT)0x002c << nDataLen << nFontId;
+ WriteString( ByteString( rFont.GetName(), RTL_TEXTENCODING_UTF8 ) );
+ if ( ( ( rFont.GetName().Len() ) & 1 ) == 0 )
+ *pPict << (BYTE)0;
+ }
+ *pPict << (USHORT)0x0003 << nFontId;
+ aDstFontName=rFont.GetName();
+ nDstFontNameId=nFontId;
+ bDstFontNameValid=TRUE;
+ }
+}
+
+
+void PictWriter::WriteOpcode_Rect(PictDrawingMethod eMethod, const Rectangle & rRect)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0030; break;
+ case PDM_PAINT: oc=0x0031; break;
+ case PDM_ERASE: oc=0x0032; break;
+ case PDM_INVERT: oc=0x0033; break;
+ case PDM_FILL: oc=0x0034; break;
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+}
+
+
+void PictWriter::WriteOpcode_SameRect(PictDrawingMethod eMethod)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0038; break;
+ case PDM_PAINT: oc=0x0039; break;
+ case PDM_ERASE: oc=0x003a; break;
+ case PDM_INVERT: oc=0x003b; break;
+ case PDM_FILL: oc=0x003c; break;
+ }
+ *pPict << oc;
+}
+
+
+void PictWriter::WriteOpcode_RRect(PictDrawingMethod eMethod, const Rectangle & rRect)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0040; break;
+ case PDM_PAINT: oc=0x0041; break;
+ case PDM_ERASE: oc=0x0042; break;
+ case PDM_INVERT: oc=0x0043; break;
+ case PDM_FILL: oc=0x0044; break;
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+}
+
+
+void PictWriter::WriteOpcode_SameRRect(PictDrawingMethod eMethod)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0048; break;
+ case PDM_PAINT: oc=0x0049; break;
+ case PDM_ERASE: oc=0x004a; break;
+ case PDM_INVERT: oc=0x004b; break;
+ case PDM_FILL: oc=0x004c; break;
+ }
+ *pPict << oc;
+}
+
+
+void PictWriter::WriteOpcode_Oval(PictDrawingMethod eMethod, const Rectangle & rRect)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0050; break;
+ case PDM_PAINT: oc=0x0051; break;
+ case PDM_ERASE: oc=0x0052; break;
+ case PDM_INVERT: oc=0x0053; break;
+ case PDM_FILL: oc=0x0054; break;
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+}
+
+
+void PictWriter::WriteOpcode_SameOval(PictDrawingMethod eMethod)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0058; break;
+ case PDM_PAINT: oc=0x0059; break;
+ case PDM_ERASE: oc=0x005a; break;
+ case PDM_INVERT: oc=0x005b; break;
+ case PDM_FILL: oc=0x005c; break;
+ }
+ *pPict << oc;
+}
+
+
+void PictWriter::WriteOpcode_Arc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0060; break;
+ case PDM_PAINT: oc=0x0061; break;
+ case PDM_ERASE: oc=0x0062; break;
+ case PDM_INVERT: oc=0x0063; break;
+ case PDM_FILL: oc=0x0064; break;
+ }
+ *pPict << oc;
+ WriteRectangle(rRect);
+ WriteArcAngles(rRect,rStartPt,rEndPt);
+}
+
+
+void PictWriter::WriteOpcode_SameArc(PictDrawingMethod eMethod, const Rectangle & rRect,
+ const Point & rStartPt, const Point & rEndPt)
+{
+ USHORT oc;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0068; break;
+ case PDM_PAINT: oc=0x0069; break;
+ case PDM_ERASE: oc=0x006a; break;
+ case PDM_INVERT: oc=0x006b; break;
+ case PDM_FILL: oc=0x006c; break;
+ }
+ *pPict << oc;
+ WriteArcAngles(rRect,rStartPt,rEndPt);
+}
+
+
+void PictWriter::WriteOpcode_Poly(PictDrawingMethod eMethod, const Polygon & rPoly)
+{
+ USHORT oc;
+
+ if (rPoly.GetSize()<3) return;
+ switch (eMethod) {
+ case PDM_FRAME: oc=0x0070; break;
+ case PDM_PAINT: oc=0x0071; break;
+ case PDM_ERASE: oc=0x0072; break;
+ case PDM_INVERT: oc=0x0073; break;
+ case PDM_FILL: oc=0x0074; break;
+ }
+ *pPict << oc;
+ WritePolygon(rPoly);
+}
+
+
+void PictWriter::WriteOpcode_BitsRect(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap)
+{
+ BitmapReadAccess* pAcc = NULL;
+ Bitmap aBitmap( rBitmap );
+
+ ULONG nWidth, nHeight, nDstRowBytes, nx, nc, ny, nCount, nColTabSize, i;
+ ULONG nDstRowPos, nSrcRowBytes, nEqu3, nPos, nDstMapPos;
+ USHORT nBitsPerPixel, nPackType;
+ BYTE *pComp[4], *pPix, *pTemp, nEquData, nFlagCounterByte, nRed, nGreen, nBlue;
+
+ SetAttrForPaint();
+
+ // temopraere Windows-BMP-Datei erzeugen:
+ nActBitmapPercent=30;
+ MayCallback();
+
+ if ( bStatus == FALSE )
+ return;
+ if ( ( pAcc = aBitmap.AcquireReadAccess() ) == NULL )
+ return;
+
+ nBitsPerPixel = aBitmap.GetBitCount();
+ nWidth = pAcc->Width();
+ nHeight = pAcc->Height();
+
+ // Wenn 24-Bit, dann den Opcode 'DirectBitsRect' erzeugen:
+ if ( nBitsPerPixel == 24 )
+ {
+
+ // Anzahl Bytes einer (ungepackten) Zeile in Quelle und Ziel berechnen:
+ nSrcRowBytes =( ( 3 * nWidth ) + 0x0003 ) & 0xfffc;
+ nDstRowBytes = nWidth * 4;
+
+ // Opcode und BaseAddr (?) schreiben:
+ *pPict << (USHORT)0x009a << (ULONG)0x000000ff;
+
+ // Normalerweise wollen wir den Packing-Type 4 (Run length encoding
+ // for 32-Bit Pixels) erzeugen. Wenn aber RowBytes<8 gilt, sind die Daten
+ // grundsaetzlich ungepackt, auch wenn der Packing-Type 4 angegeben ist,
+ // was etwas komisch erscheint. Daher wollen wir in so einem Fall lieber
+ // gleich den Packing-Type 1 (ungepackt) angeben:
+
+ if ( nDstRowBytes < 8 )
+ nPackType = 1;
+ else
+ nPackType = 4;
+
+ // PixMap-Struktur schreiben:
+ *pPict << (USHORT)(nDstRowBytes|0x8000) // Bytes pro Zeile und dass es eine 'PixMap' ist
+ << (USHORT)0x0000 // Y1-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // X1-Position der Bitmap in der Quelle
+ << (USHORT)nHeight // Y2-Position der Bitmap in der Quelle
+ << (USHORT)nWidth // X2-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // Version
+ << (USHORT)nPackType // Packing type
+ << (ULONG) 0x00000000 // Packing size (?)
+ << (ULONG) 0x00480000 // H-Res
+ << (ULONG) 0x00480000 // V-Res
+ << (USHORT)0x0010 // Pixel type (?)
+ << (USHORT)0x0020 // Pixel size: 32 bit
+ << (USHORT)0x0004 // CmpCount: 4 Komponenten
+ << (USHORT)0x0008 // CmpSize: 8 Bits
+ << (ULONG) 0x00000000 // PlaneBytes (?)
+ << (ULONG) 0x00000000 // (?)
+ << (ULONG) 0x00000000; // (?)
+
+ // Source-Rectangle schreiben:
+ *pPict << (USHORT)0x0000 // Y1-Position auf der Bitmap
+ << (USHORT)0x0000 // X1-Position auf der Bitmap
+ << (USHORT)nHeight // Y2-Position auf der Bitmap
+ << (USHORT)nWidth; // X2-Position auf der Bitmap
+
+ // Destination-Rectangle schreiben:
+ WritePoint( rPoint );
+ WritePoint( Point( rPoint.X() + rSize.Width(), rPoint.Y() + rSize.Height() ) );
+
+ // Transfer mode schreiben:
+ *pPict << (USHORT)0x0000; // (?)
+
+ // Position der Map-Daten in Ziel merken:
+ nDstMapPos=pPict->Tell();
+
+ if ( nPackType == 1 ) // bei 24 bits nWidth == 1 !!
+ { // nicht packen
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ *pPict << (BYTE)0;
+ *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetRed();
+ *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetGreen();
+ *pPict << (BYTE)pAcc->GetPixel( ny, 0 ).GetBlue();
+ // Prozente zaehlen, Callback, Fehler pruefen:
+ nActBitmapPercent = ( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus)
+ MayCallback();
+ }
+ }
+ else // packen ( PackType == 4 )
+ {
+ // Speicher fuer Zeilen-Zwischen-Datenstruktur allozieren:
+ for ( nc = 0; nc < 4; nc++ )
+ pComp[ nc ] = new BYTE[ nWidth ];
+
+ // Schleife ueber Zeilen:
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+ // Zeil ny der Quelle in die Zwischen-Datenstrktur einlesen:
+
+ for ( nx = 0; nx < nWidth; nx++ )
+ {
+ pComp[ 1 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetRed();
+ pComp[ 2 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetGreen();
+ pComp[ 3 ][ nx ] = (BYTE)pAcc->GetPixel( ny, nx ) .GetBlue();
+ pComp[ 0 ][ nx ] = 0;
+ }
+
+ // Anfang der Zeile im Ziel merken:
+ nDstRowPos = pPict->Tell();
+
+ // ByteCount (das ist die Groesse der gepackten Zeile) zunaechst 0 (wird spaeter berichtigt):
+ if ( nDstRowBytes > 250 )
+ *pPict << (USHORT)0;
+ else
+ *pPict << (BYTE)0;
+
+ // Schleife ueber Componenten:
+ for ( nc = 0; nc < 4; nc++ )
+ {
+ // Schleife ueber x:
+ nx = 0;
+ while ( nx < nWidth )
+ {
+ // Die Position von 3 gleichen Bytes suchen und in nEqu3 merken.
+ // wenn nicht gefunden, dann nEqu3=nWidth setzten.
+ // Wenn doch gefunden, dann in nEquData den Wert der Bytes merken.
+ nEqu3 = nx;
+ for (;;)
+ {
+ if ( nEqu3 + 2 >= nWidth )
+ {
+ nEqu3 = nWidth;
+ break;
+ }
+ nEquData = pComp[nc][nEqu3];
+ if ( nEquData == pComp[nc][nEqu3+1] && nEquData==pComp[nc][nEqu3+2] )
+ break;
+ nEqu3++;
+ }
+
+ // Die Daten von nx bis nEqu3 unkomprimiert schreiben (ggf. in mehreren Records):
+ while ( nEqu3 > nx )
+ {
+ nCount = nEqu3 - nx;
+ if ( nCount > 128 )
+ nCount=128;
+ nFlagCounterByte = (BYTE)(nCount-1);
+ *pPict << nFlagCounterByte;
+ do
+ {
+ *pPict << pComp[nc][nx++];
+ nCount--;
+ }
+ while ( nCount > 0 );
+ }
+
+ // Jetzt einen Komprimierungs-Record erzeugen (falls oben mindestens 3
+ // gleiche Bytes gefunden):
+ if ( nx < nWidth )
+ { // Hinweis: es gilt nx==nEqu3 (hoffentlich)
+ nCount=3; // Drei Bytes sind gleich, wie weiter oben herausgefunden.
+ // Pruefen, ob es weitere gleiche Bytes gibts (dabei Max.-Record-Groesse beachten):
+ while ( nx + nCount < nWidth && nCount < 128 )
+ {
+ if ( nEquData != pComp[ nc ][ nx + nCount ] )
+ break;
+ nCount++;
+ }
+ // nCount gleiche Bytes komprimiert schreiben:
+ nFlagCounterByte = (BYTE)( 1 - (long)nCount );
+ *pPict << nFlagCounterByte << nEquData;
+ nx += nCount;
+ }
+ }
+ }
+ // ByteCount berichtigen:
+ nPos = pPict->Tell();
+ pPict->Seek( nDstRowPos );
+ if ( nDstRowBytes > 250 )
+ *pPict << ( (USHORT)( nPos - nDstRowPos - 2 ) );
+ else
+ *pPict << ( (BYTE)( nPos - nDstRowPos - 1 ) );
+ pPict->Seek( nPos );
+
+ // Prozente zaehlen, Callback, Fehler pruefen:
+ nActBitmapPercent = ( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus)
+ MayCallback();
+ }
+ // Aufraeumen:
+ for ( nc = 0; nc < 4; nc++ )
+ delete pComp[ nc ];
+ }
+ }
+ else
+ { // nicht 24-Bit also Opcode 'PackBitsRect' erzeugen:
+
+ // Bei 1-Bit-Bildern ignorieren manche Import-Filter die Palette und nehmen statt
+ // dessen die Vorder- und Hintergrundfarbe:
+ if ( nBitsPerPixel == 1 )
+ {
+ WriteOpcode_RGBBkCol( pAcc->GetPaletteColor( 0 ) );
+ WriteOpcode_RGBFgCol( pAcc->GetPaletteColor( 1 ) );
+ }
+ else
+ {
+ WriteOpcode_RGBBkCol( Color( COL_BLACK ) );
+ WriteOpcode_RGBFgCol( Color( COL_WHITE ) );
+ }
+
+ // Anzahl Bytes einer (ungepackten) Zeile in Ziel und Quelle berechnen:
+ nDstRowBytes = ( nWidth * nBitsPerPixel + 7 ) >> 3;
+ nSrcRowBytes = ( nDstRowBytes + 3 ) & 0xfffffffc;
+
+ // Opcode schreiben:
+ *pPict << (USHORT)0x0098;
+
+ // Normalerweise wollen wir den Packing-Type 0 (default Packing) erzeugen.
+ // Wenn aber RowBytes<8 gilt, sind die Daten grundsaetzlich ungepackt,
+ // auch wenn der Packing-Type 0 angegeben ist, was etwas komisch erscheint.
+ // Daher wollen wir in so einem Fall lieber gleich den Packing-Type 1 (ungepackt)
+ // angeben:
+ if ( nDstRowBytes < 8 )
+ nPackType = 1;
+ else
+ nPackType = 0;
+
+ // PixMap-Struktur schreiben:
+ *pPict << (USHORT)(nDstRowBytes|0x8000) // Bytes pro Zeile und dass es eine 'PixMap' ist
+ << (USHORT)0x0000 // Y1-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // X1-Position der Bitmap in der Quelle
+ << (USHORT)nHeight // Y2-Position der Bitmap in der Quelle
+ << (USHORT)nWidth // X2-Position der Bitmap in der Quelle
+ << (USHORT)0x0000 // Version
+ << (USHORT)nPackType // Packing type
+ << (ULONG) 0x00000000 // Packing size (?)
+ << (ULONG) 0x00480000 // H-Res
+ << (ULONG) 0x00480000 // V-Res
+ << (USHORT)0x0000 // Pixel type (?)
+ << (USHORT)nBitsPerPixel // Pixel size
+ << (USHORT)0x0001 // CmpCount: 1 Komponente
+ << (USHORT)nBitsPerPixel // CmpSize
+ << (ULONG) 0x00000000 // PlaneBytes (?)
+ << (ULONG) 0x00000000 // (?)
+ << (ULONG) 0x00000000; // (?)
+
+ // Palette lesen und schreiben:
+ nColTabSize = pAcc->GetPaletteEntryCount();
+ *pPict << (ULONG)0 << (USHORT)0x8000 << (USHORT)( nColTabSize - 1 );
+
+ for ( i = 0; i < nColTabSize; i++ )
+ {
+ nRed = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetRed();
+ nGreen = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetGreen();
+ nBlue = (BYTE)pAcc->GetPaletteColor( (USHORT)i ).GetBlue();
+ *pPict << (UINT16)0 << nRed << nRed << nGreen << nGreen << nBlue << nBlue;
+ }
+
+ // Source-Rectangle schreiben:
+ *pPict << (USHORT)0 << (USHORT)0 << (USHORT)nHeight << (USHORT)nWidth;
+
+ // Destination-Rectangle schreiben:
+ WritePoint( rPoint );
+ WritePoint( Point( rPoint.X() + rSize.Width(), rPoint.Y() + rSize.Height() ) );
+
+ // Transfer mode schreiben:
+ *pPict << (USHORT)0; // (?)
+
+ // Speicher fuer eine Zeile allozieren:
+ pPix = new BYTE[ nSrcRowBytes ];
+
+ // Position der Map-Daten in Ziel merken:
+ nDstMapPos=pPict->Tell();
+
+ // Schleife ueber Zeilen:
+ for ( ny = 0; ny < nHeight; ny++ )
+ {
+
+ // Zeile ny der Quelle in den Zwischenspeicher einlesen:
+
+ switch ( nBitsPerPixel )
+ {
+ case 1 :
+ for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ )
+ *pTemp++ = (BYTE)0;
+ for ( i = 0; i < nWidth; i++ )
+ pPix[ ( i >> 3 ) ] |= (BYTE)( pAcc->GetPixel( ny, i ) & 1 ) << ( ( i & 7 ) ^ 7 );
+ break;
+ case 4 :
+ for ( pTemp = pPix, i = 0; i < nSrcRowBytes; i++ )
+ *pTemp++ = (BYTE)0;
+ for ( i = 0; i < nWidth; i++ )
+ pPix[ ( i >> 1 ) ] |= (BYTE)( pAcc->GetPixel( ny, i ) & 15 ) << ( ( i & 1 ) << 2 ) ;
+ break;
+ case 8 :
+ for ( i = 0; i < nWidth; i++ )
+ pPix[ i ] = (BYTE)pAcc->GetPixel( ny, i );
+ break;
+ }
+
+ if ( nPackType == 1 )
+ { // nicht packen
+ pPict->Write( pPix, nDstRowBytes );
+ }
+ else
+ { // Packen (nPackType==0)
+
+ // Anfang der Zeile im Ziel merken:
+ nDstRowPos = pPict->Tell();
+
+ // ByteCount (das ist die Groesse der gepackten Zeile) zunaechst 0 (wird spaeter berichtigt):
+ if ( nDstRowBytes > 250 )
+ *pPict << (USHORT)0;
+ else
+ *pPict << (BYTE)0;
+
+ // Schleife ueber Bytes der Zeile:
+ nx=0;
+ while ( nx < nDstRowBytes && bStatus )
+ {
+ // Die Position von 3 gleichen Bytes suchen und in nEqu3 merken.
+ // wenn nicht gefunden, dann nEqu3=nDstRowBytes setzten.
+ // Wenn doch gefunden, dann in nEquData den Wert der Bytes merken.
+ nEqu3 = nx;
+ for (;;)
+ {
+ if ( nEqu3 + 2 >= nDstRowBytes )
+ {
+ nEqu3 = nDstRowBytes;
+ break;
+ }
+ nEquData = pPix[ nEqu3 ];
+ if ( nEquData == pPix[ nEqu3 + 1 ] && nEquData == pPix[ nEqu3 + 2 ] )
+ break;
+ nEqu3++;
+ }
+
+ // Die Daten von nx bis nEqu3 unkomprimiert schreiben (ggf. in mehreren Records):
+ while ( nEqu3 > nx )
+ {
+ nCount = nEqu3 - nx;
+ if ( nCount > 128 )
+ nCount = 128;
+ nFlagCounterByte = (BYTE)( nCount - 1 );
+ *pPict << nFlagCounterByte;
+ do
+ {
+ *pPict << pPix[ nx++ ];
+ nCount--;
+ } while ( nCount > 0 );
+ }
+
+ // Jetzt einen Komprimierungs-Record erzeugen (falls oben mindestens 3
+ // gleiche Bytes gefunden):
+ if ( nx < nDstRowBytes )
+ { // Hinweis: es gilt nx==nEqu3 (hoffentlich)
+ nCount = 3; // Drei Bytes sind gleich, wie weiter oben herausgefunden.
+ // Pruefen, ob es weitere gleiche Bytes gibts (dabei Max.-Record-Groesse beachten):
+ while ( nx + nCount < nDstRowBytes && nCount < 128 )
+ {
+ if ( nEquData != pPix[ nx + nCount ] )
+ break;
+ nCount++;
+ }
+ // nCount gleiche Bytes komprimiert schreiben:
+ nFlagCounterByte = (BYTE)( 1 - (long)nCount );
+ *pPict << nFlagCounterByte << nEquData;
+ nx += nCount;
+ }
+ }
+
+ // ByteCount berichtigen:
+ nPos = pPict->Tell();
+ pPict->Seek( nDstRowPos );
+ if ( nDstRowBytes > 250 )
+ *pPict << ( (USHORT)( nPos - nDstRowPos - 2 ) );
+ else
+ *pPict << ( (BYTE)( nPos - nDstRowPos - 1 ) );
+ pPict->Seek( nPos );
+ }
+
+ // Prozente zaehlen, Callback, Fehler pruefen:
+ nActBitmapPercent =( ny * 70 / nHeight ) + 30; // (30% machten schon das Schreiben der Win-BMP-Datei aus)
+ MayCallback();
+ if ( pPict->GetError() )
+ bStatus = FALSE;
+ }
+ // Aufraeumen:
+ delete pPix;
+ }
+
+ // Map-Daten muessen gerade Anzahl von Bytes sein:
+ if ( ( ( pPict->Tell() - nDstMapPos ) & 1 ) != 0 )
+ *pPict << (BYTE)0;
+
+ // Bitmaps zaehlen:
+ nWrittenBitmaps++;
+ nActBitmapPercent = 0;
+ if ( pAcc )
+ aBitmap.ReleaseAccess( pAcc );
+}
+
+void PictWriter::WriteOpcode_EndOfFile()
+{
+ *pPict << (USHORT)0x00ff;
+}
+
+
+void PictWriter::SetAttrForPaint()
+{
+ WriteOpcode_PnMode(eSrcRasterOp);
+ WriteOpcode_RGBFgCol(aFillColor);
+ WriteOpcode_RGBBkCol(aFillColor);
+ WriteOpcode_PnFillPat(aFillColor!=Color( COL_TRANSPARENT ));
+}
+
+
+void PictWriter::SetAttrForFrame()
+{
+ WriteOpcode_PnMode(eSrcRasterOp);
+ WriteOpcode_PnSize(0);
+ WriteOpcode_RGBFgCol(aLineColor);
+ WriteOpcode_PnLinePat(aLineColor!=Color( COL_TRANSPARENT ));
+}
+
+
+void PictWriter::SetAttrForText()
+{
+ WriteOpcode_RGBFgCol(aSrcFont.GetColor());
+ WriteOpcode_RGBBkCol(aSrcFont.GetFillColor());
+ WriteOpcode_PnLinePat(TRUE);
+ WriteOpcode_FontName(aSrcFont);
+ WriteOpcode_TxSize((USHORT)(aSrcFont.GetSize().Height()));
+ WriteOpcode_TxMode(eSrcRasterOp);
+ WriteOpcode_TxFace(aSrcFont);
+}
+
+
+void PictWriter::WriteTextArray(Point & rPoint, const ByteString& rString, const long * pDXAry)
+{
+ USHORT i,nLen;
+ sal_Char c;
+ BOOL bDelta;
+ Point aPt;
+
+ if ( pDXAry == NULL )
+ WriteOpcode_Text( rPoint, rString, FALSE );
+ else
+ {
+ bDelta = FALSE;
+ nLen = rString.Len();
+ for ( i = 0; i < nLen; i++ )
+ {
+ c = rString.GetChar( i );
+ if ( (unsigned char) c > 32 )
+ {
+ aPt = rPoint;
+ if ( i > 0 )
+ aPt.X() += pDXAry[ i - 1 ];
+
+ WriteOpcode_Text( aPt, ByteString( c ), bDelta );
+ bDelta = TRUE;
+ }
+ }
+ }
+}
+
+
+void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
+{
+ ULONG nA, nACount;
+ const MetaAction* pMA;
+
+ if( !bStatus)
+ return;
+
+ nACount=rMTF.GetActionCount();
+
+ for (nA=0; nAGetType())
+ {
+ case META_PIXEL_ACTION:
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pMA;
+ WriteOpcode_PnMode(eSrcRasterOp);
+ WriteOpcode_PnSize(1);
+ WriteOpcode_RGBFgCol(pA->GetColor());
+ WriteOpcode_PnLinePat(TRUE);
+ WriteOpcode_Line(pA->GetPoint(),pA->GetPoint());
+ }
+ break;
+
+ case META_POINT_ACTION:
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pMA;
+
+ if( aLineColor != Color( COL_TRANSPARENT ) )
+ {
+ SetAttrForFrame();
+ WriteOpcode_Line( pA->GetPoint(),pA->GetPoint() );
+ }
+ }
+ break;
+
+ case META_LINE_ACTION:
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pMA;
+
+ if( aLineColor != Color( COL_TRANSPARENT ) )
+ {
+ SetAttrForFrame();
+ WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() );
+ }
+ break;
+ }
+
+ case META_RECT_ACTION:
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Rect(PDM_PAINT,pA->GetRect());
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameRect(PDM_FRAME);
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Rect(PDM_FRAME,pA->GetRect());
+ }
+ }
+ break;
+
+ case META_ROUNDRECT_ACTION:
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pMA;
+
+ WriteOpcode_OvSize( Size( pA->GetHorzRound(), pA->GetVertRound() ) );
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_RRect(PDM_PAINT,pA->GetRect());
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameRRect(PDM_FRAME);
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_RRect(PDM_FRAME,pA->GetRect());
+ }
+ }
+ break;
+
+ case META_ELLIPSE_ACTION:
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Oval(PDM_PAINT,pA->GetRect());
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameOval(PDM_FRAME);
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Oval(PDM_FRAME,pA->GetRect());
+ }
+ }
+ break;
+
+ case META_ARC_ACTION:
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pMA;
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Arc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+ }
+ }
+ break;
+
+ case META_PIE_ACTION:
+ {
+ const MetaPieAction* pA = (const MetaPieAction *) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Arc(PDM_PAINT,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_SameArc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+ }
+ }
+ else if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Arc(PDM_FRAME,pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint());
+ }
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ double fxc,fyc,fxr,fyr,fx1,fy1,fx2,fy2,l1,l2;
+
+ fxc=((double)(pA->GetRect().Left()+pA->GetRect().Right()))/2.0;
+ fyc=((double)(pA->GetRect().Top()+pA->GetRect().Bottom()))/2.0;
+ fxr=((double)pA->GetRect().GetWidth())/2.0;
+ fyr=((double)pA->GetRect().GetHeight())/2.0;
+ fx1=((double)pA->GetStartPoint().X())-fxc;
+ fy1=((double)pA->GetStartPoint().Y())-fyc;
+ fx2=((double)pA->GetEndPoint().X())-fxc;
+ fy2=((double)pA->GetEndPoint().Y())-fyc;
+ l1=sqrt(fx1*fx1+fy1*fy1);
+ l2=sqrt(fx2*fx2+fy2*fy2);
+
+ if (l1>0)
+ {
+ fx1=fx1/l1*fxr;
+ fy1=fy1/l1*fyr;
+ }
+
+ if (l2>0)
+ {
+ fx2=fx2/l2*fxr;
+ fy2=fy2/l2*fyr;
+ }
+ fx1+=fxc; fy1+=fyc; fx2+=fxc; fy2+=fyc;
+ WriteOpcode_Line(Point((long)(fx1+0.5),(long)(fy1+0.5)), Point((long)(fxc+0.5),(long)(fyc+0.5)));
+ WriteOpcode_LineFrom(Point((long)(fx2+0.5),(long)(fy2+0.5)));
+ }
+ }
+ break;
+
+ case META_CHORD_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_CHORD_ACTION!" );
+ }
+ break;
+
+ case META_POLYLINE_ACTION:
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
+
+ if( aLineColor!=Color( COL_TRANSPARENT ) )
+ {
+ const Polygon& rPoly = pA->GetPolygon();
+ const USHORT nSize = rPoly.GetSize();
+ Point aLast;
+
+ if ( nSize )
+ {
+ SetAttrForFrame();
+ aLast = rPoly[0];
+
+ for ( USHORT i = 1; i < nSize; i++ )
+ {
+ WriteOpcode_Line( aLast, rPoly[i] );
+ aLast = rPoly[i];
+ }
+ }
+ }
+ }
+ break;
+
+ case META_POLYGON_ACTION:
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Poly(PDM_PAINT,pA->GetPolygon());
+ }
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ WriteOpcode_Poly(PDM_FRAME,pA->GetPolygon());
+ }
+ }
+ break;
+
+ case META_POLYPOLYGON_ACTION:
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pMA;
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Poly(PDM_PAINT,PolyPolygonToPolygon(pA->GetPolyPolygon()));
+ }
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ USHORT nCount,i;
+ SetAttrForFrame();
+ nCount=pA->GetPolyPolygon().Count();
+ for (i=0; iGetPolyPolygon().GetObject(i));
+ }
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pMA;
+ Point aPt( pA->GetPoint() );
+
+ if ( aSrcFont.GetAlign() != ALIGN_BASELINE )
+ {
+ VirtualDevice aVirDev;
+
+ if (aSrcFont.GetAlign()==ALIGN_TOP)
+ aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ }
+
+ SetAttrForText();
+ String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() );
+ WriteOpcode_Text( aPt, ByteString( aStr, RTL_TEXTENCODING_UTF8 ) ,FALSE );
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA;
+ Point aPt( pA->GetPoint() );
+
+ if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
+ {
+ VirtualDevice aVirDev;
+
+ if (aSrcFont.GetAlign()==ALIGN_TOP)
+ aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ }
+ SetAttrForText();
+ String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() );
+ WriteTextArray( aPt, ByteString( aStr, RTL_TEXTENCODING_UTF8 ), pA->GetDXArray() );
+ break;
+ }
+
+ case META_STRETCHTEXT_ACTION:
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pMA;
+ Point aPt( pA->GetPoint() );
+ String aStr( pA->GetText(),pA->GetIndex(),pA->GetLen() );
+ VirtualDevice aVirDev;
+ long* pDXAry = new long[ aStr.Len() ];
+ sal_Int32 nNormSize( aVirDev.GetTextArray( aStr,pDXAry ) );
+ USHORT i;
+
+ if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
+ {
+ if (aSrcFont.GetAlign()==ALIGN_TOP)
+ aPt.Y()+=(long)aVirDev.GetFontMetric(aSrcFont).GetAscent();
+ else
+ aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
+ }
+
+ for ( i = 0; i < aStr.Len() - 1; i++ )
+ pDXAry[ i ] = pDXAry[ i ] * ( (long)pA->GetWidth() ) / nNormSize;
+
+ SetAttrForText();
+ WriteTextArray( aPt, ByteString( aStr, RTL_TEXTENCODING_UTF8 ), pDXAry );
+ delete[] pDXAry;
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_TEXTRECT_ACTION!" );
+ }
+ break;
+
+ case META_BMP_ACTION:
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pMA;
+ WriteOpcode_BitsRect( pA->GetPoint(),pA->GetBitmap().GetSizePixel(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA;
+ WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA;
+ Bitmap aBmp( pA->GetBitmap() );
+
+ aBmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ WriteOpcode_BitsRect( pA->GetDestPoint(), pA->GetDestSize(), aBmp );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pMA;
+ const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ WriteOpcode_BitsRect( pA->GetPoint(), aBmp.GetSizePixel(), aBmp );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
+ const Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), aBmp );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA;
+ Bitmap aBmp( Graphic( pA->GetBitmapEx() ).GetBitmap() );
+
+ aBmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ WriteOpcode_BitsRect( pA->GetDestPoint(), pA->GetDestSize(), aBmp );
+ }
+ 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;
+ WriteOpcode_BitsRect( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() );
+ break;
+ }
+ }
+ }
+ break;
+
+ case META_MASK_ACTION:
+ case META_MASKSCALE_ACTION:
+ case META_MASKSCALEPART_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_MASK..._ACTION!" );
+ }
+ break;
+
+ case META_GRADIENT_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaGradientAction* pA = (const MetaGradientAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ WriteOpcodes( aTmpMtf );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+ const MetaHatchAction* pA = (const MetaHatchAction*) pMA;
+
+ aVDev.SetMapMode( aTargetMapMode );
+ aVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ WriteOpcodes( aTmpMtf );
+ }
+ break;
+
+ case META_WALLPAPER_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_WALLPAPER_ACTION!" );
+ }
+ break;
+
+ case META_CLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_CLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_ISECTRECTCLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_ISECTRECTCLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_ISECTREGIONCLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_MOVECLIPREGION_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_MOVECLIPREGION_ACTION!" );
+ }
+ break;
+
+ case META_LINECOLOR_ACTION:
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aLineColor = pA->GetColor();
+ else
+ aLineColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_FILLCOLOR_ACTION:
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aFillColor = pA->GetColor();
+ else
+ aFillColor = Color( COL_TRANSPARENT );
+ }
+ break;
+
+ case META_TEXTCOLOR_ACTION:
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pMA;
+ aSrcFont.SetColor( pA->GetColor() );
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION:
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aSrcFont.SetFillColor( pA->GetColor() );
+ else
+ aSrcFont.SetFillColor( Color( COL_TRANSPARENT ) );
+ }
+ break;
+
+ case META_TEXTALIGN_ACTION:
+ {
+// DBG_ERROR( "Unsupported PICT-Action: META_TEXTALIGN_ACTION!" );
+ }
+ 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();
+ }
+ }
+ break;
+
+ case META_FONT_ACTION:
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pMA;
+ aSrcFont=pA->GetFont();
+ }
+ break;
+
+ case META_PUSH_ACTION:
+ {
+ PictWriterAttrStackMember * pAt = new PictWriterAttrStackMember;
+ pAt->aLineColor=aLineColor;
+ pAt->aFillColor=aFillColor;
+ pAt->eRasterOp=eSrcRasterOp;
+ pAt->aFont=aSrcFont;
+ pAt->aMapMode=aSrcMapMode;
+ pAt->pSucc=pAttrStack;
+ pAttrStack=pAt;
+ }
+ break;
+
+ case META_POP_ACTION:
+ {
+ PictWriterAttrStackMember* pAt=pAttrStack;
+
+ if( pAt )
+ {
+ aLineColor=pAt->aLineColor;
+ aFillColor=pAt->aFillColor;
+ eSrcRasterOp=pAt->eRasterOp;
+ aSrcFont=pAt->aFont;
+ aSrcMapMode=pAt->aMapMode;
+ pAttrStack=pAt->pSucc;
+ delete pAt;
+ }
+ }
+ break;
+
+ case META_RASTEROP_ACTION:
+ {
+ const MetaRasterOpAction* pA = (const MetaRasterOpAction*) pMA;
+ eSrcRasterOp=pA->GetRasterOp();
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ const PolyPolygon& rPolyPoly = ( (const MetaTransparentAction*) pMA )->GetPolyPolygon();
+
+ if (aFillColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForPaint();
+ WriteOpcode_Poly( PDM_PAINT, PolyPolygonToPolygon( rPolyPoly ) );
+ }
+
+ if (aLineColor!=Color( COL_TRANSPARENT ))
+ {
+ SetAttrForFrame();
+ for( USHORT i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ WriteOpcode_Poly( PDM_FRAME, rPolyPoly.GetObject( i ) );
+ }
+ }
+ 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;
+
+ 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 );
+
+ WriteOpcodes( aTmpMtf );
+ }
+ break;
+ }
+
+ nWrittenActions++;
+ MayCallback();
+
+ if (pPict->GetError())
+ bStatus=FALSE;
+
+ if (bStatus==FALSE)
+ break;
+ }
+}
+
+
+void PictWriter::WriteHeader(const GDIMetaFile & rMTF)
+{
+ USHORT i;
+ Size aSize( OutputDevice::LogicToLogic( rMTF.GetPrefSize(),
+ rMTF.GetPrefMapMode(),
+ aTargetMapMode ) );
+ short nWidth = (short) ( aSize.Width() + 1L );
+ short nHeight = (short) ( aSize.Height() + 1L );
+
+ // 512 Bytes "Muell" am Anfang:
+ for (i=0;i<128;i++) *pPict << (ULONG)0;
+
+ // Lo-16-Bits der Groesse der Datei ohne die 512 Bytes Muell:
+ *pPict << (USHORT)0; // wird spaeter durch UpdateHeader() berichtigt
+
+ // Das Bounding-Rectangle (y1,x1,y2,x2 !):
+ *pPict << (short)0 << (short)0
+ << nHeight << nWidth;
+
+ // Version 2:
+ *pPict << (ULONG)0x001102ff;
+
+ // Extended-Version-2-Header:
+ *pPict << (USHORT)0x0c00 // Opcode
+ << (USHORT)0xfffe // Version (?)
+ << (USHORT)0x0000 // Reserved
+ << (ULONG) 0x00480000 // hRes
+ << (ULONG) 0x00480000 // vRes
+ << (USHORT)0x0000 // SrcRect-Y1
+ << (USHORT)0x0000 // SrcRect-X1
+ << nHeight // SrcRect-Y2
+ << nWidth // SrcRect-X2
+ << (ULONG)0x00000000; // Reserved
+
+ // viele Import-Filter verlangen die Angabe eines
+ // Clipping-Bereichs am Anfang
+ *pPict << (USHORT)0x0001
+ << (USHORT)0x000a
+ << (USHORT)0x0000
+ << (USHORT)0x0000
+ << nHeight
+ << nWidth;
+}
+
+
+void PictWriter::UpdateHeader()
+{
+ ULONG nPos;
+
+ // Lo-16-Bits der Groesse der Datei ohne die 512 Bytes Muell berichtigen:
+ nPos=pPict->Tell();
+ pPict->Seek(512);
+ *pPict << (USHORT)((nPos-512)&0x0000ffff);
+ pPict->Seek(nPos);
+}
+
+
+BOOL PictWriter::WritePict(const GDIMetaFile & rMTF, SvStream & rTargetStream, PFilterCallback pcallback, void * pcallerdata)
+{
+ PictWriterAttrStackMember* pAt;
+ MapMode aMap72( MAP_INCH );
+ Fraction aDPIFrac( 1, 72 );
+
+ bStatus=TRUE;
+
+ pCallback=pcallback;
+ pCallerData=pcallerdata;
+ nLastPercent=0;
+
+ pPict=&rTargetStream;
+ pPict->SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN);
+
+ aLineColor=Color( COL_BLACK );
+ aFillColor=Color( COL_WHITE );
+ eSrcRasterOp=ROP_OVERPAINT;
+ aSrcFont=Font();
+ aSrcMapMode = rMTF.GetPrefMapMode();
+
+ aMap72.SetScaleX( aDPIFrac );
+ aMap72.SetScaleY( aDPIFrac );
+ aTargetMapMode = aMap72;
+
+ pAttrStack=NULL;
+
+ bDstBkPatValid=FALSE;
+ bDstTxFaceValid=FALSE;
+ bDstTxModeValid=FALSE;
+ bDstPnSizeValid=FALSE;
+ bDstPnModeValid=FALSE;
+ bDstPnPatValid=FALSE;
+ bDstFillPatValid=FALSE;
+ bDstTxSizeValid=FALSE;
+ bDstFgColValid=FALSE;
+ bDstBkColValid=FALSE;
+ bDstPenPositionValid=FALSE;
+ bDstTextPositionValid=FALSE;
+ bDstFontNameValid=FALSE;
+
+ nNumberOfActions=0;
+ nNumberOfBitmaps=0;
+ nWrittenActions=0;
+ nWrittenBitmaps=0;
+ nActBitmapPercent=0;
+
+ CountActionsAndBitmaps(rMTF);
+
+ WriteHeader(rMTF);
+ WriteOpcodes(rMTF);
+ WriteOpcode_EndOfFile();
+ UpdateHeader();
+
+ while (pAttrStack!=NULL) {
+ pAt=pAttrStack;
+ pAttrStack=pAt->pSucc;
+ delete pAt;
+ }
+
+ return bStatus;
+}
+
+//================== GraphicExport - die exportierte Funktion ================
+
+#ifdef WNT
+extern "C" BOOL _cdecl GraphicExport(SvStream & rStream, Graphic & rGraphic,
+ PFilterCallback pCallback, void * pCallerData,
+ Config *, BOOL)
+#else
+extern "C" BOOL GraphicExport(SvStream & rStream, Graphic & rGraphic,
+ PFilterCallback pCallback, void * pCallerData,
+ Config *, BOOL)
+#endif
+{
+ PictWriter aPictWriter;
+
+ if (rGraphic.GetType()==GRAPHIC_GDIMETAFILE)
+ {
+ GDIMetaFile aScaledMtf( rGraphic.GetGDIMetaFile() );
+
+/*
+ MapMode aMap72( MAP_INCH );
+ Fraction aDPIFrac( 1, 72 );
+ Size aOldSize = aScaledMtf.GetPrefSize();
+
+ aMap72.SetScaleX( aDPIFrac );
+ aMap72.SetScaleY( aDPIFrac );
+
+ Size aNewSize = OutputDevice::LogicToLogic( aOldSize,
+ aScaledMtf.GetPrefMapMode(),
+ aMap72 );
+
+ aScaledMtf.Scale( Fraction( aNewSize.Width(), aOldSize.Width() ),
+ Fraction( aNewSize.Height(), aOldSize.Height() ) );
+ aScaledMtf.SetPrefMapMode( aMap72 );
+ aScaledMtf.SetPrefSize( aNewSize );
+*/
+
+ return aPictWriter.WritePict( aScaledMtf, rStream, pCallback, pCallerData );
+ }
+ else
+ {
+ Bitmap aBmp=rGraphic.GetBitmap();
+ GDIMetaFile aMTF;
+ VirtualDevice aVirDev;
+
+ aMTF.Record(&aVirDev);
+ aVirDev.DrawBitmap(Point(),aBmp);
+ aMTF.Stop();
+ aMTF.SetPrefSize(aBmp.GetSizePixel());
+ return aPictWriter.WritePict(aMTF,rStream,pCallback,pCallerData);
+ }
+}
+
+//================== GraphicDialog - die exportierte Funktion ================
+
+extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow && rPara.pCfg )
+ {
+ ByteString aResMgrName( "ept" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPCT( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+
+//=============================== fuer Windows ==============================
+
+#pragma hdrstop
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/goodies/source/filter.vcl/epict/epictstr.src b/goodies/source/filter.vcl/epict/epictstr.src
new file mode 100644
index 000000000000..9b4181bc7366
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/epictstr.src
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: epictstr.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "strings.hrc"
+
+String KEY_MODE
+{
+ Text = "PCT-EXPORT-MODE";
+};
+
+String KEY_SIZEX
+{
+ Text = "PCT-EXPORT-SIZEX";
+};
+
+String KEY_SIZEY
+{
+ Text = "PCT-EXPORT-SIZEY";
+};
diff --git a/goodies/source/filter.vcl/epict/makefile.mk b/goodies/source/filter.vcl/epict/makefile.mk
new file mode 100644
index 000000000000..7afbc9e0223b
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/makefile.mk
@@ -0,0 +1,186 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=epict
+TARGET2=ept
+DEPTARGET=vepict
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(COM)"=="WTC"
+CFLAGSOPT= -od -3r
+.ENDIF
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRCFILES = dlgepct.src \
+ epictstr.src
+
+SLOFILES = $(SLO)$/epict.obj \
+ $(SLO)$/dlgepct.obj
+
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=\
+ $(SRS)$/$(TARGET).srs
+
+SHL1TARGET= ept$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= epict
+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB)
+
+SHL1DEPN= $(LB)$/epict.lib
+SHL1LIBS= $(SLB)$/epict.lib # $(LB)$/rtftoken.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/epict.obj
+.ENDIF
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+ @echo _DoExportDialog >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET) >>$@
+ @echo GraphicExport_ >>temp.def
+ @echo DoExportDialog_ >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/epict/strings.hrc b/goodies/source/filter.vcl/epict/strings.hrc
new file mode 100644
index 000000000000..89b93b729e0b
--- /dev/null
+++ b/goodies/source/filter.vcl/epict/strings.hrc
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define KEY_MODE 260
+#define KEY_SIZEX 262
+#define KEY_SIZEY 264
+
diff --git a/goodies/source/filter.vcl/eppm/dlgeppm.cxx b/goodies/source/filter.vcl/eppm/dlgeppm.cxx
new file mode 100644
index 000000000000..5b22e9c4a6fd
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/dlgeppm.cxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeppm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+#include
+#include
+#include
+#include "dlgeppm.hxx"
+#include "dlgeppm.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPPM::DlgExportEPPM( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPPM, rPara.pResMgr ) ),
+ aGrpFormat ( this, ResId( GRP_FORMAT ) ),
+ aRBRaw ( this, ResId( RB_RAW ) ),
+ aRBASCII ( this, ResId( RB_ASCII ) ),
+ 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
+
+ String aFormatStr( ResId( KEY_FORMAT, pMgr ) );
+ sal_Int32 nFormat = pConfig->ReadKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+
+ BOOL bCheck = FALSE;
+ if ( !nFormat )
+ bCheck ^= TRUE;
+ aRBRaw.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBASCII.Check( bCheck );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPPM, OK ) );
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPPM, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+
+ sal_Int32 nCheck = 0;
+ if ( aRBASCII.IsChecked() )
+ nCheck++;
+
+ String aFormatStr( ResId( KEY_FORMAT, pMgr ) );
+ pConfig->WriteKey( ByteString( aFormatStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
diff --git a/goodies/source/filter.vcl/eppm/dlgeppm.hrc b/goodies/source/filter.vcl/eppm/dlgeppm.hrc
new file mode 100644
index 000000000000..e9e24ba05965
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/dlgeppm.hrc
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeppm.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "goodies.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_FORMAT 1
+#define RB_RAW 1
+#define RB_ASCII 2
diff --git a/goodies/source/filter.vcl/eppm/dlgeppm.hxx b/goodies/source/filter.vcl/eppm/dlgeppm.hxx
new file mode 100644
index 000000000000..7a9f8edeb72e
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/dlgeppm.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeppm.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DLGEPPM_HXX_
+#define _DLGEPPM_HXX_
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class Config;
+class ResMgr;
+
+class DlgExportEPPM : public ModalDialog
+{
+private:
+ GroupBox aGrpFormat;
+ RadioButton aRBRaw;
+ RadioButton aRBASCII;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEPPM( FltCallDialogParameter& rPara );
+};
+
+#endif // _DLGEPPM_HXX_
diff --git a/goodies/source/filter.vcl/eppm/dlgeppm.src b/goodies/source/filter.vcl/eppm/dlgeppm.src
new file mode 100644
index 000000000000..7f249795f6a3
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/dlgeppm.src
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeppm.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "dlgeppm.hrc"
+ModalDialog DLG_EXPORT_EPPM
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 133 , 67 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text = "PPM Optionen" ;
+ Text [ ENGLISH ] = "PPM options" ;
+ Text [ english_us ] = "PPM Options" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 73 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 73 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 73 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ GroupBox GRP_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 54 ) ;
+ Text = "Datei Format" ;
+ Text [ ENGLISH ] = "file format" ;
+ Text[ italian ] = "Formato file";
+ Text[ portuguese_brazilian ] = "Datei Format";
+ Text[ portuguese ] = "Formato do ficheiro";
+ Text[ danish ] = "Filformat";
+ Text[ french ] = "Format de fichier";
+ Text[ swedish ] = "Filformat";
+ Text[ dutch ] = "Bestandsformaat";
+ Text[ spanish ] = "Formato de archivo";
+ Text[ english_us ] = "File format";
+ Text[ chinese_simplified ] = "Îļþ¸ñʽ";
+ Text[ russian ] = "Ôîðìàò ôàéëà";
+ Text[ polish ] = "Format pliku";
+ Text[ japanese ] = "̧²ÙŒ`Ž®";
+ Text[ chinese_traditional ] = "Àɮ׮榡";
+ Text[ arabic ] = "ÊäÓíÞ ÇáãáÝ";
+ Text[ dutch ] = "Bestandsformaat";
+ Text[ chinese_simplified ] = "Îļþ¸ñʽ";
+ Text[ greek ] = "ÌïñöÞ áñ÷åßïõ";
+ Text[ korean ] = "ÆÄÀÏ ¼½Ä";
+ Text[ turkish ] = "Dosya formatý";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_RAW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Binär" ;
+ Text [ ENGLISH ] = "~raw" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Binario";
+ Text[ portuguese_brazilian ] = "~Binär";
+ Text[ portuguese ] = "~Binário";
+ Text[ danish ] = "~Binær";
+ Text[ french ] = "~Binaire";
+ Text[ swedish ] = "~Binär";
+ Text[ dutch ] = "~Binair";
+ Text[ spanish ] = "~Binario";
+ Text[ english_us ] = "~Binary";
+ Text[ chinese_simplified ] = "¶þÔª(~B)";
+ Text[ russian ] = "Áèíàðíûé";
+ Text[ polish ] = "Binarny";
+ Text[ japanese ] = "ÊÞ²ÅØ(~B)";
+ Text[ language_user1 ] = " ";
+ Text[ chinese_traditional ] = "¤G¦ì¤¸(~B)";
+ Text[ arabic ] = "ËäÇÆí";
+ Text[ dutch ] = "~Binair";
+ Text[ chinese_simplified ] = "¶þÔª(~B)";
+ Text[ greek ] = "Äõáäéêü";
+ Text[ korean ] = "¹ÙÀ̳ʸ®(~B)";
+ Text[ turkish ] = "Ýkili";
+ };
+ RadioButton RB_ASCII
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Text" ;
+ Text [ ENGLISH ] = "~text" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Testo";
+ Text[ portuguese_brazilian ] = "~Text";
+ Text[ portuguese ] = "~Texto";
+ Text[ danish ] = "~Tekst";
+ Text[ french ] = "~Texte";
+ Text[ swedish ] = "~Text";
+ Text[ dutch ] = "~Tekst";
+ Text[ spanish ] = "~Texto";
+ Text[ english_us ] = "~Text";
+ Text[ chinese_simplified ] = "ÎÄ×Ö(~T)";
+ Text[ russian ] = "Òåêñò";
+ Text[ polish ] = "Tekst";
+ Text[ japanese ] = "÷½Ä(~T)";
+ Text[ chinese_traditional ] = "¤å¦r(~T)";
+ Text[ arabic ] = "ÇáäÕ";
+ Text[ dutch ] = "~Tekst";
+ Text[ chinese_simplified ] = "ÎÄ×Ö(~T)";
+ Text[ greek ] = "Êåßìåíï";
+ Text[ korean ] = "ÅؽºÆ®(~T)";
+ Text[ turkish ] = "Metin";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ italian ] = "Opzioni PPM";
+ Text[ portuguese_brazilian ] = "PPM Optionen";
+ Text[ portuguese ] = "Opções PPM";
+ Text[ danish ] = "PPM indstillinger";
+ Text[ french ] = "Options PPM";
+ Text[ swedish ] = "PPM alternativ";
+ Text[ dutch ] = "PPM-opties";
+ Text[ spanish ] = "Opciones PPM ";
+ Text[ chinese_simplified ] = "PPM Ñ¡Ïî";
+ Text[ russian ] = "Ïàðàìåòðû PPM";
+ Text[ polish ] = "Opcje PPM";
+ Text[ japanese ] = "PPM µÌß¼®Ý";
+ Text[ chinese_traditional ] = "PPM¿ï¶µ";
+ Text[ arabic ] = "PPM ÎíÇÑÇÊ";
+ Text[ dutch ] = "PPM-opties";
+ Text[ chinese_simplified ] = "PPM Ñ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò PPM";
+ Text[ korean ] = "PPM ¿É¼Ç";
+ Text[ turkish ] = "PPM seçenekleri";
+ Text[ language_user1 ] = " ";
+};
diff --git a/goodies/source/filter.vcl/eppm/eppm.cxx b/goodies/source/filter.vcl/eppm/eppm.cxx
new file mode 100644
index 000000000000..0733f05e09dc
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/eppm.cxx
@@ -0,0 +1,347 @@
+/*************************************************************************
+ *
+ * $RCSfile: eppm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+#include
+#include
+#include
+#include
+#include "strings.hrc"
+#include "dlgeppm.hrc"
+#include "dlgeppm.hxx"
+
+//============================ PPMWriter ==================================
+
+class PPMWriter {
+
+private:
+
+ PFilterCallback mpCallback;
+ void * mpCallerData;
+
+ SvStream* mpOStm; // Die auszugebende PPM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ sal_Int32 mnMode;
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+
+ BOOL ImplCallback( USHORT nPercent );
+ BOOL ImplWriteHeader();
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+
+public:
+ PPMWriter();
+ ~PPMWriter();
+
+ BOOL WritePPM( const Graphic& rGraphic, SvStream& rPPM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig );
+};
+
+//=================== Methoden von PPMWriter ==============================
+
+PPMWriter::PPMWriter() :
+ mpAcc ( NULL ),
+ mbStatus ( TRUE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PPMWriter::~PPMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PPMWriter::ImplCallback( USHORT nPercent )
+{
+ if ( mpCallback != NULL )
+ {
+ if ( ( (*mpCallback)( mpCallerData, nPercent ) ) == TRUE )
+ {
+ mpOStm->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PPMWriter::WritePPM( const Graphic& rGraphic, SvStream& rPPM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig )
+{
+
+ mpOStm = &rPPM;
+ mpCallback = pCallback;
+ mpCallerData = pCallerdata;
+
+ if ( pOptionsConfig )
+ {
+ mnMode = pOptionsConfig->ReadKey( "PPM-EXPORT-FORMAT", "0" ).ToInt32();
+ }
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ Bitmap aBmp = aBmpEx.GetBitmap();
+ aBmp.Convert( BMP_CONVERSION_24BIT );
+
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ mpAcc = aBmp.AcquireReadAccess();
+ if( mpAcc )
+ {
+ if ( ImplWriteHeader() )
+ {
+ ImplWriteBody();
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PPMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight )
+ {
+ if ( mnMode == 0 )
+ *mpOStm << "P6\x0a";
+ else
+ *mpOStm << "P3\x0a";
+
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( 255 ); // max. col.
+ *mpOStm << (BYTE)10;
+ }
+ else
+ mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void PPMWriter::ImplWriteBody()
+{
+ if ( mnMode == 0 )
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPixel( y, x );
+ *mpOStm << rColor.GetRed();
+ *mpOStm << rColor.GetGreen();
+ *mpOStm << rColor.GetBlue();
+ }
+ }
+ }
+ else
+ {
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ int nCount = 70;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ BYTE i, nDat[3], nNumb;
+ if ( nCount < 0 )
+ {
+ nCount = 69;
+ *mpOStm << (BYTE)10;
+ }
+ nDat[0] = mpAcc->GetPixel( y, x ).GetRed();
+ nDat[1] = mpAcc->GetPixel( y, x ).GetGreen();
+ nDat[2] = mpAcc->GetPixel( y, x ).GetBlue();
+ for ( i = 0; i < 3; i++ )
+ {
+ if ( ( nNumb = nDat[ i ] / 100 ) )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat[ i ] -= ( nNumb * 100 );
+ nNumb = nDat[ i ] / 10;
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat[ i ] -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ nCount -= 4;
+ }
+ else if ( ( nNumb = nDat[ i ] / 10 ) )
+ {
+ *mpOStm << (BYTE)( nNumb + '0' );
+ nDat[ i ] -= ( nNumb * 10 );
+ *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ nCount -= 3;
+ }
+ else
+ {
+ *mpOStm << (BYTE)( nDat[ i ] + '0' );
+ nCount -= 2;
+ }
+ *mpOStm << (BYTE)' ';
+ }
+ }
+ *mpOStm << (BYTE)10;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void PPMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int32 n = 0, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig, BOOL )
+{
+ PPMWriter aPPMWriter;
+
+ return aPPMWriter.WritePPM( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow && rPara.pCfg )
+ {
+ ByteString aResMgrName( "epp" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational(). GetLanguage() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPPM( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+#pragma hdrstop
+
+// ------------------------------------------------------------------------
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/eppm/eppmstr.src b/goodies/source/filter.vcl/eppm/eppmstr.src
new file mode 100644
index 000000000000..aa78128a25f4
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/eppmstr.src
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: eppmstr.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_FORMAT
+{
+ Text = "PPM-EXPORT-FORMAT";
+};
diff --git a/goodies/source/filter.vcl/eppm/makefile.mk b/goodies/source/filter.vcl/eppm/makefile.mk
new file mode 100644
index 000000000000..a3f6207e6f88
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/makefile.mk
@@ -0,0 +1,183 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=eppm
+TARGET2=epp
+DEPTARGET=veppm
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRCFILES= dlgeppm.src \
+ eppmstr.src
+
+SLOFILES = $(SLO)$/eppm.obj \
+ $(SLO)$/dlgeppm.obj
+
+# ==========================================================================
+
+RESLIB1NAME=$(TARGET2)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+
+SHL1TARGET= epp$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= eppm
+SHL1STDLIBS= $(TOOLSLIB) \
+ $(SVLIB) \
+ $(CPPULIB) \
+ $(SVTOOLLIB)
+
+SHL1DEPN= $(LB)$/eppm.lib
+SHL1LIBS= $(SLB)$/eppm.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/eppm.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+ @echo _DoExportDialog >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).DLL >>$@
+ @ldump -E1 -A $(SLB)$/eppm.lib >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/eppm/strings.hrc b/goodies/source/filter.vcl/eppm/strings.hrc
new file mode 100644
index 000000000000..851e6b569d01
--- /dev/null
+++ b/goodies/source/filter.vcl/eppm/strings.hrc
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define KEY_FORMAT 256
diff --git a/goodies/source/filter.vcl/eps/dlgeps.cxx b/goodies/source/filter.vcl/eps/dlgeps.cxx
new file mode 100644
index 000000000000..4e189c05b363
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/dlgeps.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeps.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+#include
+#include
+#include
+#include "dlgeps.hxx"
+#include "dlgeps.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEPS::DlgExportEPS( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPS, rPara.pResMgr ) ),
+ aGrpPreview ( this, ResId( GRP_PREVIEW ) ),
+ aCBPreviewTiff ( this, ResId( CB_PREVIEW_TIFF ) ),
+ aCBPreviewEPSI ( this, ResId( CB_PREVIEW_EPSI ) ),
+ aGrpVersion ( this, ResId( GRP_VERSION ) ),
+ aRBLevel1 ( this, ResId( RB_LEVEL1 ) ),
+ aRBLevel2 ( this, ResId( RB_LEVEL2 ) ),
+ aGrpColor ( this, ResId( GRP_COLOR ) ),
+ aRBColor ( this, ResId( RB_COLOR ) ),
+ aRBGrayscale ( this, ResId( RB_GRAYSCALE ) ),
+ aGrpCompression ( this, ResId( GRP_COMPRESSION ) ),
+ aRBCompressionLZW ( this, ResId( RB_COMPRESSION_LZW ) ),
+ aRBCompressionNone ( this, ResId( RB_COMPRESSION_NONE ) ),
+ 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
+ String aPrevStr( ResId( KEY_PREVIEW, pMgr ) );
+ String aVersionStr( ResId( KEY_VERSION, pMgr ) );
+ String aColorStr( ResId( KEY_COLOR, pMgr ) );
+ String aComprStr( ResId( KEY_COMPR, pMgr ) );
+
+ sal_Int32 nPreview = pConfig->ReadKey( ByteString( aPrevStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+ sal_Int32 nVersion = pConfig->ReadKey( ByteString( aVersionStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+ sal_Int32 nColor = pConfig->ReadKey( ByteString( aColorStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+ sal_Int32 nCompr = pConfig->ReadKey( ByteString( aComprStr, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+
+ BOOL bCheck = FALSE;
+ if ( nPreview & 1 )
+ bCheck = TRUE;
+ aCBPreviewTiff.Check( bCheck );
+ if ( nPreview & 2 )
+ bCheck = TRUE;
+ aCBPreviewEPSI.Check( bCheck );
+
+ bCheck = FALSE;
+ if ( nVersion == 1 )
+ bCheck ^= TRUE;
+ aRBLevel1.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBLevel2.Check( bCheck );
+
+ bCheck = FALSE;
+ if ( nColor == 1 )
+ bCheck ^= TRUE;
+ aRBColor.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBGrayscale.Check( bCheck );
+
+ bCheck = FALSE;
+ if ( nCompr == 1 )
+ bCheck ^= TRUE;
+ aRBCompressionLZW.Check( bCheck );
+ bCheck ^= TRUE;
+ aRBCompressionNone.Check( bCheck );
+
+ if ( aRBLevel1.IsChecked() )
+ {
+ aRBColor.Disable();
+ aRBGrayscale.Disable();
+ aRBCompressionNone.Disable();
+ aRBCompressionLZW.Disable();
+ aRBCompressionNone.Disable();
+ }
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEPS, OK ) );
+ aRBLevel1.SetClickHdl( LINK( this, DlgExportEPS, LEVEL1 ) );
+ aRBLevel2.SetClickHdl( LINK( this, DlgExportEPS, LEVEL2 ) );
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEPS, OK, void *, EMPTYARG )
+{
+
+ // Config-Parameter schreiben
+ sal_Int32 nCheck = 0;
+ if ( aCBPreviewTiff.IsChecked() )
+ nCheck++;
+ if ( aCBPreviewEPSI.IsChecked() )
+ nCheck += 2;
+
+ String aPrevStr( ResId( KEY_PREVIEW, pMgr ) );
+ pConfig->WriteKey( ByteString( aPrevStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) );
+
+ nCheck = 1;
+ if ( aRBLevel2.IsChecked() )
+ nCheck++;
+ String aVersionStr( ResId( KEY_VERSION, pMgr ) );
+ pConfig->WriteKey( ByteString( aVersionStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) );
+
+ nCheck = 1;
+ if ( aRBGrayscale.IsChecked() )
+ nCheck++;
+ String aColorStr( ResId( KEY_COLOR, pMgr ) );
+ pConfig->WriteKey( ByteString( aColorStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) );
+
+ nCheck = 1;
+ if ( aRBCompressionNone.IsChecked() )
+ nCheck++;
+ String aComprStr( ResId( KEY_COMPR, pMgr ) );
+ pConfig->WriteKey( ByteString( aComprStr, RTL_TEXTENCODING_UTF8 ), ByteString::CreateFromInt32( nCheck ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( DlgExportEPS, LEVEL1, void*, EMPTYARG )
+{
+ if ( aRBLevel1.IsChecked() )
+ {
+ aRBColor.Disable();
+ aRBGrayscale.Disable();
+ aRBCompressionLZW.Disable();
+ aRBCompressionNone.Disable();
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( DlgExportEPS, LEVEL2, void*, EMPTYARG )
+{
+ if ( aRBLevel2.IsChecked() )
+ {
+ aRBColor.Enable();
+ aRBGrayscale.Enable();
+ aRBCompressionLZW.Enable();
+ aRBCompressionNone.Enable();
+ }
+ return 0;
+}
+
diff --git a/goodies/source/filter.vcl/eps/dlgeps.hrc b/goodies/source/filter.vcl/eps/dlgeps.hrc
new file mode 100644
index 000000000000..d7a547839311
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/dlgeps.hrc
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeps.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "goodies.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define GRP_PREVIEW 1
+#define GRP_VERSION 2
+#define GRP_COLOR 3
+#define GRP_COMPRESSION 4
+#define CB_PREVIEW_TIFF 1
+#define CB_PREVIEW_EPSI 2
+#define RB_LEVEL1 3
+#define RB_LEVEL2 4
+#define RB_COLOR 5
+#define RB_GRAYSCALE 6
+#define RB_COMPRESSION_LZW 7
+#define RB_COMPRESSION_NONE 8
diff --git a/goodies/source/filter.vcl/eps/dlgeps.hxx b/goodies/source/filter.vcl/eps/dlgeps.hxx
new file mode 100644
index 000000000000..b7f48b9903af
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/dlgeps.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeps.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 _DLGEPS_HXX_
+#define _DLGEPS_HXX_
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+
+class Config;
+class ResMgr;
+
+class DlgExportEPS : public ModalDialog
+{
+private:
+ GroupBox aGrpPreview;
+ CheckBox aCBPreviewTiff;
+ CheckBox aCBPreviewEPSI;
+ GroupBox aGrpVersion;
+ RadioButton aRBLevel1;
+ RadioButton aRBLevel2;
+ GroupBox aGrpColor;
+ RadioButton aRBColor;
+ RadioButton aRBGrayscale;
+ GroupBox aGrpCompression;
+ RadioButton aRBCompressionLZW;
+ RadioButton aRBCompressionNone;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+ DECL_LINK( LEVEL1, void* );
+ DECL_LINK( LEVEL2, void* );
+
+public:
+ DlgExportEPS( FltCallDialogParameter& rPara );
+};
+
+#endif // _DLGEPS_HXX_
diff --git a/goodies/source/filter.vcl/eps/dlgeps.src b/goodies/source/filter.vcl/eps/dlgeps.src
new file mode 100644
index 000000000000..94fb44a3fa2f
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/dlgeps.src
@@ -0,0 +1,459 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgeps.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "dlgeps.hrc"
+ModalDialog DLG_EXPORT_EPS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 149 , 198 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text = "EPS Export Optionen" ;
+ Text [ ENGLISH ] = "EPS export options" ;
+ Text[ portuguese ] = "Opções exportação EPS";
+ Text[ russian ] = "Ïàðàìåòðû ýêñïîðòà EPS";
+ Text[ dutch ] = "EPS export opties";
+ Text[ french ] = "Options d'export EPS";
+ Text[ spanish ] = "Opciones Exportación EPS";
+ Text[ italian ] = "Opzioni d'esportazione EPS";
+ Text[ danish ] = "EPS eksportindstillinger";
+ Text[ swedish ] = "EPS exportalternativ";
+ Text[ polish ] = "Opcje eksportowe EPS";
+ Text[ english_us ] = "EPS Export Options";
+ Text[ portuguese_brazilian ] = "EPS Export Optionen";
+ Text[ japanese ] = "EPS ´¸½Î߰ĵÌß¼®Ý";
+ Text[ chinese_simplified ] = "EPS Êä³öÑ¡Ïî";
+ Text[ chinese_traditional ] = "EPS ¿é¥X¿ï¶µ";
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 93 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 93 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 93 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+ GroupBox GRP_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 42 ) ;
+ Text = "Vorschau";
+ Text [ ENGLISH ] = "Preview";
+ Text[ italian ] = "Anteprima";
+ Text[ portuguese_brazilian ] = "Vorschau";
+ Text[ portuguese ] = "Previsualização";
+ Text[ danish ] = "Eksempel";
+ Text[ french ] = "Aperçu";
+ Text[ swedish ] = "Förhandsvisning";
+ Text[ dutch ] = "Voorbeeld";
+ Text[ spanish ] = "Previsualización";
+ Text[ english_us ] = "Preview";
+ Text[ chinese_simplified ] = "Ô¤ÊÓ";
+ Text[ russian ] = "Ïðîñìîòð";
+ Text[ polish ] = "Podgl¹d";
+ Text[ japanese ] = "ÌßÚËÞ°";
+ Text[ chinese_traditional ] = "À˵ø";
+ Text[ arabic ] = "ãÚÇíäÉ";
+ Text[ dutch ] = "Voorbeeld";
+ Text[ chinese_simplified ] = "Ô¤ÊÓ";
+ Text[ greek ] = "Ðñïåðéóêüðçóç";
+ Text[ korean ] = "¹Ì¸® º¸±â";
+ Text[ turkish ] = "Önizleme";
+ };
+ CheckBox CB_PREVIEW_TIFF
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 71 , 10 ) ;
+ Text = "~Vorschau Bild (Tiff)" ;
+ Text [ ENGLISH ] = "~Preview picture (Tiff)" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Anteprima immagine (Tiff)";
+ Text[ portuguese_brazilian ] = "~Vorschau Bild (Tiff)";
+ Text[ portuguese ] = "~Previzualizar imagem (Tiff)";
+ Text[ danish ] = "~Vis billede (Tiff)";
+ Text[ french ] = "~Aperçu (Tiff)";
+ Text[ swedish ] = "Förhandsvisning bild (Tiff)";
+ Text[ dutch ] = "~Voorbeeldvenster (TIFF)";
+ Text[ spanish ] = "~Previsualización (Tiff)";
+ Text[ english_us ] = "Image ~preview (TIFF)";
+ Text[ chinese_simplified ] = "ͼÏñÔ¤ÊÓ(~TIFF)";
+ Text[ russian ] = "Ïðîñìîòð êàðòèíêè (TIFF)";
+ Text[ polish ] = "Podgl¹d rysunku (Tiff)";
+ Text[ japanese ] = "}‚ÌÌßÚËÞ° (Tiff)(~P)";
+ Text[ arabic ] = "ãÚÇíäÉ ÇáÕæÑÉ(TIFF) ";
+ Text[ dutch ] = "~Voorbeeldvenster (TIFF)";
+ Text[ chinese_simplified ] = "ͼÏñÔ¤ÊÓ(~TIFF)";
+ Text[ greek ] = "Ðñïåðéóêüðçóç åéêüíáò (TIFF)";
+ Text[ korean ] = "±×¸² ¹Ì¸® º¸±â (TIFF)(~P)";
+ Text[ chinese_traditional ] = "¹Ï¤ù¹wÄý(TIFF)(~P)";
+ Text[ turkish ] = "Resim önizleme (TIFF)";
+ };
+ CheckBox CB_PREVIEW_EPSI
+ {
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 71, 10 ) ;
+ Text = "~Interchange (EPSI)" ;
+ Text [ ENGLISH ] = "~Interchange (EPSI)" ;
+ TabStop = TRUE ;
+ Text[ english_us ] = "~Interchange (EPSI)";
+ Text[ portuguese ] = "~Interchange (EPSI)";
+ Text[ russian ] = "~Interchange (EPSI)";
+ Text[ greek ] = "~Interchange (EPSI)";
+ Text[ dutch ] = "~Interchange (EPSI)";
+ Text[ french ] = "~Interchange (EPSI)";
+ Text[ spanish ] = "~Interchange (EPSI)";
+ Text[ italian ] = "~Interchange (EPSI)";
+ Text[ danish ] = "~Interchange (EPSI)";
+ Text[ swedish ] = "Interchange (EPSI)";
+ Text[ polish ] = "~Interchange (EPSI)";
+ Text[ portuguese_brazilian ] = "~Interchange (EPSI)";
+ Text[ japanese ] = "²ÝÀ°ÁªÝ¼Þ(EPSI)(~I)";
+ Text[ korean ] = "ÀÎÅÍüÀÎÁö (EPSI)(~I)";
+ Text[ chinese_simplified ] = "»¥»»(EPS~I)";
+ Text[ chinese_traditional ] = "¤¬´«(EPS~I)";
+ Text[ arabic ] = "~Interchange (EPSI)";
+ Text[ turkish ] = "Interchange (EPSI)";
+ };
+
+ GroupBox GRP_VERSION
+ {
+ Pos = MAP_APPFONT ( 6 , 51 ) ;
+ Size = MAP_APPFONT ( 80 , 42 ) ;
+ Text = "Version";
+ Text [ ENGLISH ] = "Version";
+ Text[ italian ] = "Versione";
+ Text[ portuguese_brazilian ] = "Version";
+ Text[ portuguese ] = "Versão";
+ Text[ danish ] = "Version";
+ Text[ french ] = "Version";
+ Text[ swedish ] = "Version";
+ Text[ dutch ] = "Versie";
+ Text[ spanish ] = "Versión";
+ Text[ english_us ] = "Version";
+ Text[ chinese_simplified ] = "°æ±¾";
+ Text[ russian ] = "Âåðñèÿ";
+ Text[ polish ] = "Wersja";
+ Text[ japanese ] = "ÊÞ°¼Þ®Ý";
+ Text[ chinese_traditional ] = "ª©¥»";
+ Text[ arabic ] = "ÅÕÏÇÑ";
+ Text[ dutch ] = "Versie";
+ Text[ chinese_simplified ] = "°æ±¾";
+ Text[ greek ] = "¸êäïóç";
+ Text[ korean ] = "¹öÀü";
+ Text[ turkish ] = "Sürüm";
+ };
+ RadioButton RB_LEVEL1
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 71 , 10 ) ;
+ Text = "Level ~1" ;
+ Text [ ENGLISH ] = "Level ~1" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "Livello ~1";
+ Text[ portuguese_brazilian ] = "Level ~1";
+ Text[ portuguese ] = "Nível ~1";
+ Text[ danish ] = "Niveau ~1";
+ Text[ french ] = "Niveau ~1";
+ Text[ swedish ] = "Nivå ~1";
+ Text[ dutch ] = "Level ~1";
+ Text[ spanish ] = "Nivel ~1";
+ Text[ english_us ] = "Level ~1";
+ Text[ chinese_simplified ] = "¼¶±ð ~1";
+ Text[ russian ] = "Óðîâåíü 1";
+ Text[ polish ] = "Poziom 1";
+ Text[ japanese ] = "ÚÍÞÙ 1";
+ Text[ chinese_traditional ] = "¯Å§O ~1";
+ Text[ arabic ] = "ÇáãÓÊæì 1";
+ Text[ dutch ] = "Level ~1";
+ Text[ chinese_simplified ] = "¼¶±ð ~1";
+ Text[ greek ] = "Åðßðåäï ~1";
+ Text[ korean ] = "·¹º§ ~1";
+ Text[ turkish ] = "Düzey ~1";
+ };
+ RadioButton RB_LEVEL2
+ {
+ Pos = MAP_APPFONT ( 12 , 78 ) ;
+ Size = MAP_APPFONT ( 71, 10 ) ;
+ Text = "Level ~2" ;
+ Text [ ENGLISH ] = "Level ~2" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "Livello ~2";
+ Text[ portuguese_brazilian ] = "Level ~2";
+ Text[ portuguese ] = "Nível ~2";
+ Text[ danish ] = "Niveau ~2";
+ Text[ french ] = "Niveau ~2";
+ Text[ swedish ] = "Nivå ~2";
+ Text[ dutch ] = "Level ~2";
+ Text[ spanish ] = "Nivel ~2";
+ Text[ english_us ] = "Level ~2";
+ Text[ chinese_simplified ] = "¼¶±ð ~2";
+ Text[ russian ] = "Óðîâåíü 2";
+ Text[ polish ] = "Poziom 2";
+ Text[ japanese ] = "ÚÍÞÙ 2";
+ Text[ chinese_traditional ] = "¯Å§O ~2";
+ Text[ arabic ] = "ÇáãÓÊæì 2";
+ Text[ dutch ] = "Level ~2";
+ Text[ chinese_simplified ] = "¼¶±ð ~2";
+ Text[ greek ] = "Åðßðåäï ~2";
+ Text[ korean ] = "·¹º§ ~2";
+ Text[ turkish ] = "Düzey ~2";
+ };
+
+ GroupBox GRP_COLOR
+ {
+ Pos = MAP_APPFONT ( 6 , 99 ) ;
+ Size = MAP_APPFONT ( 80 , 42 ) ;
+ Text = "Farb Format";
+ Text [ ENGLISH ] = "Color Type";
+ Text[ italian ] = "Formato colore";
+ Text[ portuguese_brazilian ] = "Farb Format";
+ Text[ portuguese ] = "Formato da cor";
+ Text[ danish ] = "Farveformat";
+ Text[ french ] = "Format de couleur";
+ Text[ swedish ] = "Färgformat";
+ Text[ dutch ] = "Kleuropmaak";
+ Text[ spanish ] = "Formato del color";
+ Text[ english_us ] = "Color format";
+ Text[ chinese_simplified ] = "ÑÕÉ«¸ñʽ";
+ Text[ russian ] = "Ôîðìàò öâåòà";
+ Text[ polish ] = "Format koloru";
+ Text[ japanese ] = "F‚Ì‘Ž®";
+ Text[ chinese_traditional ] = "ÃC¦â®æ¦¡";
+ Text[ arabic ] = "ÊäÓíÞ Çááæä";
+ Text[ dutch ] = "Kleuropmaak";
+ Text[ chinese_simplified ] = "ÑÕÉ«¸ñʽ";
+ Text[ greek ] = "ÌïñöÞ ÷ñþìáôïò";
+ Text[ korean ] = "»ö ¼½Ä";
+ Text[ turkish ] = "Renk formatý";
+ };
+ RadioButton RB_COLOR
+ {
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 71, 10 ) ;
+ Text = "~Farbe" ;
+ Text [ ENGLISH ] = "~Color" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "~Colore";
+ Text[ portuguese_brazilian ] = "~Farbe";
+ Text[ portuguese ] = "~Cor";
+ Text[ danish ] = "~Farve";
+ Text[ french ] = "~Couleur";
+ Text[ swedish ] = "~Färg";
+ Text[ dutch ] = "~Kleur";
+ Text[ spanish ] = "~Color";
+ Text[ english_us ] = "~Color";
+ Text[ chinese_simplified ] = "ÑÕÉ«(~C)";
+ Text[ russian ] = "Öâåò";
+ Text[ polish ] = "Kolor";
+ Text[ japanese ] = "F(~C)";
+ Text[ chinese_traditional ] = "ÃC¦â(~C)";
+ Text[ arabic ] = "Çááæä";
+ Text[ dutch ] = "~Kleur";
+ Text[ chinese_simplified ] = "ÑÕÉ«(~C)";
+ Text[ greek ] = "×ñþìá";
+ Text[ korean ] = "»ö(~C)";
+ Text[ turkish ] = "Renk";
+ };
+ RadioButton RB_GRAYSCALE
+ {
+ Pos = MAP_APPFONT ( 12 , 126 ) ;
+ Size = MAP_APPFONT ( 71, 10 ) ;
+ Text = "~Graustufen" ;
+ Text [ ENGLISH ] = "~Grayscale" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "Toni di grigio";
+ Text[ portuguese_brazilian ] = "~Graustufen";
+ Text[ portuguese ] = "~Tons de cinzento";
+ Text[ danish ] = "Gråtoner";
+ Text[ french ] = "~Niveaux de gris";
+ Text[ swedish ] = "~Gråskalor";
+ Text[ dutch ] = "~Grijswaarden";
+ Text[ spanish ] = "~Escala de grises";
+ Text[ english_us ] = "~Grayscale";
+ Text[ chinese_simplified ] = "»Ò¶È(~G)";
+ Text[ russian ] = "Îòòåíêè ñåðîãî";
+ Text[ polish ] = "Odcienie szaroœci";
+ Text[ japanese ] = "¸ÞÚ°½¹°Ù(~G)";
+ Text[ chinese_traditional ] = "¦Ç¯Å(~G)";
+ Text[ arabic ] = "ÏÑÌÇÊ ÇáÑãÇÏí";
+ Text[ dutch ] = "~Grijswaarden";
+ Text[ chinese_simplified ] = "»Ò¶È(~G)";
+ Text[ greek ] = "ÄéáâÜèìéóç ôïõ ãêñé";
+ Text[ korean ] = "ȸ»öÁ¶(~G)";
+ Text[ turkish ] = "Gri tonlarý";
+ };
+
+ GroupBox GRP_COMPRESSION
+ {
+ Pos = MAP_APPFONT ( 6 , 147 ) ;
+ Size = MAP_APPFONT ( 80 , 42 ) ;
+ Text = "Kompression";
+ Text [ ENGLISH ] = "Compression";
+ Text[ italian ] = "Compressione";
+ Text[ portuguese_brazilian ] = "Kompression";
+ Text[ portuguese ] = "Compressão";
+ Text[ danish ] = "Kompression";
+ Text[ french ] = "Compression";
+ Text[ swedish ] = "Kompression";
+ Text[ dutch ] = "Compressie";
+ Text[ spanish ] = "Compresión";
+ Text[ english_us ] = "Compression";
+ Text[ chinese_simplified ] = "ѹËõ";
+ Text[ russian ] = "Óæàòèå";
+ Text[ polish ] = "Kompresja";
+ Text[ japanese ] = "ˆ³k";
+ Text[ chinese_traditional ] = "À£ÁY";
+ Text[ arabic ] = "ÖÛØ";
+ Text[ dutch ] = "Compressie";
+ Text[ chinese_simplified ] = "ѹËõ";
+ Text[ greek ] = "Óõìðßåóç";
+ Text[ korean ] = "¾ÐÃà";
+ Text[ turkish ] = "Sýkýþtýrma";
+ };
+ RadioButton RB_COMPRESSION_LZW
+ {
+ Pos = MAP_APPFONT ( 12 , 158 );
+ Size = MAP_APPFONT ( 71, 10 ) ;
+ Text = "LZW Kodierung" ;
+ Text [ ENGLISH ] = "LZW Compression" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "Codifica LZW";
+ Text[ portuguese_brazilian ] = "LZW Kodierung";
+ Text[ portuguese ] = "Codificação LZW";
+ Text[ danish ] = "LZW kodning";
+ Text[ french ] = "Encodage LZW";
+ Text[ swedish ] = "LZW-kodning";
+ Text[ dutch ] = "LZW-codering";
+ Text[ spanish ] = "Codificación LZW";
+ Text[ english_us ] = "LZW encoding";
+ Text[ chinese_simplified ] = "LZW ±àÂë";
+ Text[ russian ] = "Êîäèðîâêà LZW";
+ Text[ polish ] = "Kodowanie LZW";
+ Text[ japanese ] = "LZW•„†‰»";
+ Text[ chinese_traditional ] = "LZW ½s½X";
+ Text[ arabic ] = "LZW ÊÑãíÒ";
+ Text[ dutch ] = "LZW-codering";
+ Text[ chinese_simplified ] = "LZW ±àÂë";
+ Text[ greek ] = "Êùäéêïðïßçóç LZW";
+ Text[ korean ] = "LZW ÀÎÄÚµù";
+ Text[ turkish ] = "LZW kodlamasý";
+ };
+ RadioButton RB_COMPRESSION_NONE
+ {
+ Pos = MAP_APPFONT ( 12 , 174 ) ;
+ Size = MAP_APPFONT ( 71, 10 ) ;
+ Text = "Keine" ;
+ Text [ ENGLISH ] = "None" ;
+ TabStop = TRUE ;
+ Text[ italian ] = "Senza";
+ Text[ portuguese_brazilian ] = "Keine";
+ Text[ portuguese ] = "Sem";
+ Text[ danish ] = "Ingen";
+ Text[ french ] = "Aucun(e)";
+ Text[ swedish ] = "Inga";
+ Text[ dutch ] = "Geen";
+ Text[ spanish ] = "Ninguno";
+ Text[ english_us ] = "None";
+ 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[ italian ] = "Opzioni d'esportazione EPS";
+ Text[ portuguese_brazilian ] = "EPS Export Optionen";
+ Text[ portuguese ] = "Opções exportação EPS";
+ Text[ danish ] = "EPS eksportindstillinger";
+ Text[ french ] = "Options d'export EPS";
+ Text[ swedish ] = "EPS exportalternativ";
+ Text[ dutch ] = "EPS export opties";
+ Text[ spanish ] = "Opciones Exportación EPS";
+ Text[ english_us ] = "EPS Export Options";
+ Text[ chinese_simplified ] = "EPS Êä³öÑ¡Ïî";
+ Text[ russian ] = "Ïàðàìåòðû ýêñïîðòà EPS";
+ Text[ polish ] = "Opcje eksportowe EPS";
+ Text[ japanese ] = "EPS ´¸½Î߰ĵÌß¼®Ý";
+ Text[ chinese_traditional ] = "EPS ¿é¥X¿ï¶µ";
+ Text[ arabic ] = "EPS ÎíÇÑÇÊ ÊÕÏíÑ";
+ Text[ dutch ] = "EPS export opties";
+ Text[ chinese_simplified ] = "EPS Êä³öÑ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò åîáãùãÞò EPS";
+ Text[ korean ] = "EPS ³»º¸³»±â ¿É¼Ç";
+ Text[ turkish ] = "EPS dýþa aktarma seçenekleri";
+};
diff --git a/goodies/source/filter.vcl/eps/eps.cxx b/goodies/source/filter.vcl/eps/eps.cxx
new file mode 100644
index 000000000000..a59fbbd4446e
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/eps.cxx
@@ -0,0 +1,2411 @@
+/*************************************************************************
+ *
+ * $RCSfile: eps.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "strings.hrc"
+#include "dlgeps.hrc"
+#include "dlgeps.hxx"
+
+#define POSTSCRIPT_BOUNDINGSEARCH 0x1000 // we only try to get the BoundingBox
+ // in the first 4096 bytes
+
+#define EPS_PREVIEW_TIFF 1
+#define EPS_PREVIEW_EPSI 2
+
+#define EPS_SCALING_FAKTOR 0.1
+
+#define PS_LINESIZE 70 // maximum number of characters a line in the output
+
+#define PS_NONE 0 // formating mode: action which is inserted behind the output
+#define PS_SPACE 1
+#define PS_RET 2
+#define PS_WRAP 4
+
+// -----------------------------Feld-Typen-------------------------------
+
+struct ChrSet
+{
+ struct ChrSet * pSucc;
+ BYTE nSet;
+ String aName;
+ FontWeight eWeight;
+};
+
+struct StackMember
+{
+ struct StackMember * pSucc;
+ Color aGlobalCol;
+ BOOL bLineCol;
+ Color aLineCol;
+ BOOL bFillCol;
+ Color aFillCol;
+ Color aTextCol;
+ BOOL bTextFillCol;
+ Color aTextFillCol;
+ Color aBackgroundCol;
+ Font aFont;
+ MapMode aMapMode;
+ double nXScale;
+ double nYScale;
+ double nXOrig;
+ double nYOrig;
+ BOOL bRegionChanged;
+ Region bClipRegion;
+ TextAlign eTextAlign;
+ Region aClipReg;
+};
+
+struct PSLZWCTreeNode
+{
+
+ PSLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat
+ PSLZWCTreeNode* pFirstChild; // erster Sohn
+ USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn
+ USHORT nValue; // Der Pixelwert
+};
+
+class PSWriter
+{
+private:
+ BOOL mbStatus;
+ ULONG mnLevelWarning; // number of embedded eps files which was not exported
+ PFilterCallback mpCallback;
+ void* mpCallerData;
+ ULONG mnLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
+ UINT32 mnLatestPush; // offset auf streamposition, an der zuletzt gepusht wurde
+
+ long mnLevel; // dialog options
+ BOOL mbGrayScale;
+ BOOL mbCompression;
+ sal_Int32 mnPreview;
+
+ SvStream* mpPS;
+ const GDIMetaFile* pMTF;
+ GDIMetaFile* pAMTF; // only created if Graphics is not a Metafile
+ MapMode aMapMode;
+ VirtualDevice aOutputDevice;
+
+ double nBoundingX1; // this represents the bounding box
+ double nBoundingY1;
+ double nBoundingX2;
+ double nBoundingY2;
+
+ double nXScaling; // represents the factor of the current ( MapMode to 100THmm )
+ double nYScaling;
+ double nXOrigin; // this points to the origin ( in 100THmm )
+ double nYOrigin; // ( eg. is the BoundingBox ( 100, 200 ... )
+ // nXOrigin and nYOrigin starts with -100 -200;
+ StackMember* pGDIStack;
+ ULONG mnCursorPos; // aktuelle Cursorposition im Output
+ Color aColor; // aktuelle Farbe die fuer den Output benutzt wird
+ BOOL bLineColor;
+ Color aLineColor; // aktuelle GDIMetafile Farbeinstellungen
+ BOOL bFillColor; //
+ Color aFillColor; //
+ Color aTextColor; //
+ BOOL bTextFillColor; //
+ Color aTextFillColor; //
+ Color aBackgroundColor; //
+ BOOL bRegionChanged;
+ Region aClipRegion;
+ TextAlign eTextAlign;
+
+ Font maFont;
+ Font maLastFont;
+ BYTE nChrSet;
+ ChrSet* pChrSetList; // Liste der Character-Sets
+ BYTE nNextChrSetId; // die erste unbenutzte ChrSet-Id
+
+ PSLZWCTreeNode* pTable; // LZW compression data
+ PSLZWCTreeNode* pPrefix; // the compression is as same as the TIFF compression
+ USHORT nDataSize;
+ USHORT nClearCode;
+ USHORT nEOICode;
+ USHORT nTableSize;
+ USHORT nCodeSize;
+ ULONG nOffset;
+ ULONG dwShift;
+
+ void MayCallback( ULONG nPercent );
+ void ImplWriteProlog( const Graphic* pPreviewEPSI = NULL );
+ void ImplWriteEpilog();
+ void ImplWriteActions( const GDIMetaFile& rMtf);
+
+ // this method makes LF's, space inserting and word wrapping as used in all nMode
+ // parameters
+ inline void ImplExecMode( ULONG nMode );
+
+ // writes char[] + LF to stream
+ inline void ImplWriteLine( char[], ULONG nMode = PS_RET );
+
+ // writes ( nNumb / 10^nCount ) in ASCII format to stream
+ void ImplWriteF( sal_Int32 nNumb, ULONG nCount = 3, ULONG nMode = PS_SPACE );
+
+ // writes a double in ASCII format to stream
+ void ImplWriteDouble( double, ULONG nMode = PS_SPACE );
+
+ // writes a long in ASCII format to stream
+ void ImplWriteLong( sal_Int32 nNumb, ULONG nMode = PS_SPACE );
+
+ // writes a byte in ASCII format to stream
+ void ImplWriteByte( BYTE nNumb, ULONG nMode = PS_SPACE );
+
+ // writes a byte in ASCII (hex) format to stream
+ void ImplWriteHexByte( BYTE nNumb, ULONG nMode = PS_WRAP );
+
+ // writes nNumb as number from 0.000 till 1.000 in ASCII format to stream
+ void ImplWriteB1( BYTE nNumb, ULONG nMode = PS_SPACE );
+
+ inline void ImplWritePoint( Point, ULONG nMode = PS_SPACE );
+ void ImplMoveTo( Point, ULONG nMode = PS_SPACE );
+ void ImplLineTo( Point, ULONG nMode = PS_SPACE );
+ void ImplLine( const Polygon & rPolygon );
+ void ImplLine( const PolyPolygon & rPolyPolygon );
+ void ImplWriteLineInfo( const LineInfo& rLineInfo );
+ void ImplRect( const Rectangle & rRectangle );
+ void ImplRectFill ( const Rectangle & rRectangle );
+ void ImplPoly( const Polygon & rPolygon );
+
+ void ImplSetClipRegion();
+ void ImplBmp( Bitmap*, Bitmap*, const Point &, double nWidth, double nHeight );
+ void ImplSetAttrForText( Point & rPoint );
+ void ImplWriteCharacter( sal_Char );
+ void ImplWriteString( const ByteString&, const INT32* pDXArry = NULL, BOOL bStretch = FALSE );
+ void ImplDefineFont( char*, char* );
+
+ void ImplClosePathFill( ULONG nMode = PS_RET );
+ void ImplClosePathDraw( ULONG nMode = PS_RET );
+ void ImplPathDraw( ULONG nMode = PS_RET );
+
+ inline void ImplWriteLineColor( ULONG nMode = PS_RET );
+ inline void ImplWriteFillColor( ULONG nMode = PS_RET );
+ inline void ImplWriteTextColor( ULONG nMode = PS_RET );
+ inline void ImplWriteTextFillColor( ULONG nMode = PS_RET );
+ void ImplWriteColor( ULONG nMode );
+
+ void ImplGetMapMode( const MapMode& );
+ BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize );
+ BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize );
+ // LZW methods
+ void StartCompression();
+ void Compress( BYTE nSrc );
+ void EndCompression();
+ inline void WriteBits( USHORT nCode, USHORT nCodeLen );
+
+public:
+ BOOL WritePS( const Graphic& rGraphic, SvStream& rTargetStream,
+ PFilterCallback, void*, Config* );
+ PSWriter();
+ ~PSWriter();
+};
+
+//========================== Methoden von PSWriter ==========================
+
+void PSWriter::MayCallback( ULONG nPercent )
+{
+
+ if ( nPercent >= mnLastPercent + 3 )
+ {
+ mnLastPercent = nPercent;
+ if( mpCallback && nPercent <= 100 )
+ {
+ if ( ( (*mpCallback)( mpCallerData, (USHORT)nPercent ) ) == TRUE )
+ mbStatus = FALSE;
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+PSWriter::PSWriter()
+{
+ pAMTF = NULL;
+}
+
+
+PSWriter::~PSWriter()
+{
+ delete pAMTF;
+}
+
+//---------------------------------------------------------------------------------
+
+BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream,
+ PFilterCallback pcallback, void* pcallerdata, Config* pOptionsConfig )
+{
+ UINT32 nStreamPosition, nPSPosition;
+
+ mbStatus = TRUE;
+ mnPreview = 0;
+ mnLevelWarning = 0;
+ mpCallback = pcallback;
+ mpCallerData = pcallerdata;
+ mnLastPercent = 0;
+ mnLatestPush = 0xEFFFFFFE;
+
+ mpPS = &rTargetStream;
+ mpPS->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ // default values for the dialog options
+ mnLevel = 2;
+ mbGrayScale = FALSE;
+ mbCompression = TRUE;
+
+ // try to get the dialog selection
+ if ( pOptionsConfig )
+ {
+ ByteString aResMgrName( "eps" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if( pResMgr )
+ {
+ String aPreviewStr( ResId( KEY_PREVIEW, pResMgr ) );
+ String aVersionStr( ResId( KEY_VERSION, pResMgr ) );
+ String aColorStr( ResId( KEY_COLOR, pResMgr ) );
+ String aComprStr( ResId( KEY_COMPR, pResMgr ) );
+
+ mnPreview = pOptionsConfig->ReadKey( ByteString( aPreviewStr, RTL_TEXTENCODING_UTF8 ), "1" ).ToInt32();
+ mnLevel = pOptionsConfig->ReadKey( ByteString( aVersionStr, RTL_TEXTENCODING_UTF8 ), "2" ).ToInt32();
+ if ( mnLevel != 1 )
+ mnLevel = 2;
+ mbGrayScale = pOptionsConfig->ReadKey( ByteString( aColorStr, RTL_TEXTENCODING_UTF8 ), "1" ).ToInt32() == 2;
+ mbCompression = pOptionsConfig->ReadKey( ByteString( aComprStr, RTL_TEXTENCODING_UTF8 ), "1" ).ToInt32() == 1;
+ delete pResMgr;
+ }
+ }
+
+ // compression is not available for Level 1
+ if ( mnLevel == 1 )
+ {
+ mbGrayScale = TRUE;
+ mbCompression = FALSE;
+ }
+
+ if ( mnPreview & EPS_PREVIEW_TIFF )
+ {
+ rTargetStream << (UINT32)0xC6D3D0C5;
+ nStreamPosition = rTargetStream.Tell();
+ rTargetStream << (UINT32)0 << (UINT32)0 << (UINT32)0 << (UINT32)0
+ << nStreamPosition + 26 << (UINT32)0 << (UINT16)0xffff;
+
+ UINT32 nErrCode;
+ if ( mbGrayScale )
+ {
+ BitmapEx aTempBitmapEx( rGraphic.GetBitmapEx() );
+ aTempBitmapEx.Convert( BMP_CONVERSION_8BIT_GREYS );
+ nErrCode = GraphicConverter::Export( rTargetStream, aTempBitmapEx, CVT_TIF ) ;
+ }
+ else
+ nErrCode = GraphicConverter::Export( rTargetStream, rGraphic, CVT_TIF ) ;
+
+ if ( nErrCode == ERRCODE_NONE )
+ {
+ rTargetStream.Seek( STREAM_SEEK_TO_END );
+ nPSPosition = rTargetStream.Tell();
+ rTargetStream.Seek( nStreamPosition + 20 );
+ rTargetStream << nPSPosition - 30; // size of tiff gfx
+ rTargetStream.Seek( nPSPosition );
+ }
+ else
+ {
+ mnPreview &=~ EPS_PREVIEW_TIFF;
+ rTargetStream.Seek( nStreamPosition - 4 );
+ }
+ }
+
+ // global default value setting
+ ChrSet* pCS;
+ StackMember* pGS;
+
+ if ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE )
+ pMTF = &rGraphic.GetGDIMetaFile();
+ else
+ pMTF = pAMTF = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+
+ ImplGetMapMode( pMTF->GetPrefMapMode() );
+
+ nBoundingX1 = nBoundingY1 = 0;
+ nBoundingX2 = pMTF->GetPrefSize().Width() * nXScaling;
+ nBoundingY2 = pMTF->GetPrefSize().Height() * nYScaling;
+
+ pGDIStack = NULL;
+ aColor = Color( COL_TRANSPARENT );
+ bLineColor = TRUE;
+ aLineColor = Color( COL_BLACK );
+ bFillColor = TRUE;
+ aFillColor = Color( COL_WHITE );
+ aBackgroundColor = Color( COL_WHITE );
+ bRegionChanged = FALSE;
+ aClipRegion.SetEmpty();
+
+ nChrSet = 0x00;
+ pChrSetList = NULL;
+ nNextChrSetId = 1;
+
+ if( pMTF->GetActionCount() )
+ {
+ ImplWriteProlog( ( mnPreview & EPS_PREVIEW_EPSI ) ? &rGraphic : NULL );
+ mnCursorPos = 0;
+ ImplWriteActions( *pMTF );
+ ImplWriteEpilog();
+ if ( mnPreview & EPS_PREVIEW_TIFF )
+ {
+ UINT32 nPosition = rTargetStream.Tell();
+ rTargetStream.Seek( nStreamPosition );
+ rTargetStream << nPSPosition;
+ rTargetStream << nPosition - nPSPosition;
+ rTargetStream.Seek( nPosition );
+ }
+ while( pChrSetList )
+ {
+ pCS=pChrSetList;
+ pChrSetList=pCS->pSucc;
+ delete pCS;
+ }
+ while( pGDIStack )
+ {
+ pGS=pGDIStack;
+ pGDIStack=pGS->pSucc;
+ delete pGS;
+ }
+ }
+ else
+ mbStatus = FALSE;
+
+ if ( mbStatus && mnLevelWarning && pOptionsConfig )
+ {
+ ByteString aResMgrName( "eps" );
+ ResMgr* pResMgr;
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+ if( pResMgr )
+ {
+ InfoBox aInfoBox( NULL, String( ResId( KEY_VERSION_CHECK, pResMgr ) ) );
+ aInfoBox.Execute();
+ delete pResMgr;
+ }
+ }
+ return mbStatus;
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteProlog( const Graphic* pPreview )
+{
+ ImplWriteLine( "%!PS-Adobe-3.0 EPSF-3.0 " );
+ *mpPS << "%%BoundingBox: "; // BoundingBox
+ ImplWriteLong( 0 );
+ ImplWriteLong( 0 );
+ aMapMode = MapMode( pMTF->GetPrefMapMode() );
+ Size aSizePoint = Application::GetDefaultDevice()->LogicToLogic( pMTF->GetPrefSize(), aMapMode, MAP_POINT );
+ ImplWriteLong( aSizePoint.Width() );
+ ImplWriteLong( aSizePoint.Height() ,PS_RET );
+ ImplWriteLine( "%%Pages: 0" );
+ ImplWriteLine( "%%Creator: Sun Microsystems, Inc." );
+ ImplWriteLine( "%%Title: none" );
+ ImplWriteLine( "%%CreationDate: none" );
+
+// defaults
+
+ *mpPS << "%%LanguageLevel: "; // Language level
+ ImplWriteLong( mnLevel, PS_RET );
+ if ( !mbGrayScale && mnLevel == 1 )
+ ImplWriteLine( "%%Extensions: CMYK" ); // CMYK extension is to set in color mode in level 1
+ ImplWriteLine( "%%EndComments" );
+ if ( pPreview && aSizePoint.Width() && aSizePoint.Height() )
+ {
+ Size aSizeBitmap( ( aSizePoint.Width() + 7 ) & ~7, aSizePoint.Height() );
+ Bitmap aTmpBitmap( pPreview->GetBitmap() );
+ aTmpBitmap.Scale( aSizeBitmap, BMP_SCALE_INTERPOLATE );
+ aTmpBitmap.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+ BitmapReadAccess* pAcc = aTmpBitmap.AcquireReadAccess();
+ if ( pAcc )
+ {
+ *mpPS << "%%BeginPreview: "; // BoundingBox
+ ImplWriteLong( aSizeBitmap.Width() );
+ ImplWriteLong( aSizeBitmap.Height() );
+ *mpPS << "1 ";
+ INT32 nLines = aSizeBitmap.Width() / 312;
+ if ( ( nLines * 312 ) != aSizeBitmap.Width() )
+ nLines++;
+ nLines *= aSizeBitmap.Height();
+ ImplWriteLong( nLines );
+ char nVal;
+ INT32 nX, nY, nCount2, nCount = 4;
+ const BitmapColor aBlack( pAcc->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ for ( nY = 0; nY < aSizeBitmap.Height(); nY++ )
+ {
+ nCount2 = 0;
+ nVal = 0;
+ for ( nX = 0; nX < aSizeBitmap.Width(); nX++ )
+ {
+ if ( !nCount2 )
+ {
+ ImplExecMode( PS_RET );
+ *mpPS << "%";
+ nCount2 = 312;
+ }
+ nVal <<= 1;
+ if ( pAcc->GetPixel( nY, nX ) == aBlack )
+ nVal |= 1;
+ if ( ! ( --nCount ) )
+ {
+ if ( nVal > 9 )
+ nVal += 'A' - 10;
+ else
+ nVal += '0';
+ *mpPS << nVal;
+ nVal = 0;
+ nCount += 4;
+ }
+ nCount2--;
+ }
+ }
+ aTmpBitmap.ReleaseAccess( pAcc );
+ ImplExecMode( PS_RET );
+ ImplWriteLine( "%%EndPreview" );
+ }
+ }
+ ImplWriteLine( "%%BeginProlog" );
+ ImplWriteLine( "%%BeginResource: SDRes" );
+
+// BEGIN EPSF
+ ImplWriteLine( "/b4_inc_state save def\n/dict_count countdictstack def\n/op_count count 1 sub def\nuserdict begin" );
+ ImplWriteLine( "0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath" );
+ ImplWriteLine( "/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if" );
+
+ ImplWriteLine( "/bdef {bind def} bind def" ); // der neue operator bdef wird erzeugt
+ if ( mbGrayScale )
+ ImplWriteLine( "/c {setgray} bdef" );
+ else
+ ImplWriteLine( "/c {setrgbcolor} bdef" );
+ ImplWriteLine( "/l {neg lineto} bdef" );
+ ImplWriteLine( "/rl {neg rlineto} bdef" );
+ ImplWriteLine( "/cl {currentlinewidth currentdash currentlinecap 2 setlinecap} bdef" );
+ ImplWriteLine( "/lc {setlinecap} bdef" );
+ ImplWriteLine( "/lw {setlinewidth} bdef" );
+ ImplWriteLine( "/ld {setdash} bdef" );
+ ImplWriteLine( "/m {neg moveto} bdef" );
+ ImplWriteLine( "/r {rotate} bdef" );
+ ImplWriteLine( "/t {translate} bdef" );
+ ImplWriteLine( "/gs {gsave} bdef" );
+ ImplWriteLine( "/gr {grestore} bdef" );
+
+ ImplWriteLine( "/f {findfont dup length dict begin" ); // Setfont
+ ImplWriteLine( "{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def" );
+ ImplWriteLine( "currentdict end /NFont exch definefont pop /NFont findfont} bdef" );
+
+ ImplWriteLine( "/s {show} bdef" );
+ ImplWriteLine( "/p {closepath} bdef" );
+ ImplWriteLine( "/sf {scalefont setfont} bdef" );
+
+ ImplWriteLine( "/pf {closepath fill}bdef" ); // close path and fill
+ ImplWriteLine( "/pc {closepath stroke}bdef" ); // close path and draw
+ ImplWriteLine( "/ps {stroke}bdef" ); // draw current path
+ ImplWriteLine( "/pum {matrix currentmatrix}bdef" ); // pushes the current matrix
+ ImplWriteLine( "/pom {setmatrix}bdef" ); // pops the matrix
+ ImplWriteLine( "/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef" );
+ ImplWriteLine( "%%EndResource" );
+ ImplWriteLine( "%%EndProlog" );
+ ImplWriteLine( "%%BeginSetup" );
+ ImplWriteLine( "%%EndSetup" );
+ ImplWriteLine( "%%Page: 1 1" );
+ ImplWriteLine( "%%BeginPageSetup" );
+ ImplWriteLine( "%%EndPageSetup" );
+
+ ImplWriteLine( "pum" );
+ ImplWriteDouble( (double)aSizePoint.Width() / (double)nBoundingX2 );
+ ImplWriteDouble( (double)aSizePoint.Height() / (double)nBoundingY2 );
+ ImplWriteLine( "scale" );
+ ImplWriteLong( 0 );
+ ImplWriteDouble( nBoundingY2 );
+ ImplWriteLine( "t" );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteEpilog()
+{
+ ImplWriteLong( 0 );
+ ImplWriteDouble( - nBoundingY2 );
+ ImplWriteLine( "t" );
+ ImplWriteLine( "pom" );
+ ImplWriteLine( "%%PageTrailer" );
+ ImplWriteLine( "%%Trailer" );
+ ImplWriteLine( "count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore" );
+ ImplWriteLine( "%%EOF" );
+}
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf )
+{
+ for( ULONG nCurAction = 0, nCount = rMtf.GetActionCount(); nCurAction < nCount; nCurAction++ )
+ {
+ MetaAction* pMA = rMtf.GetAction( nCurAction );
+
+ switch( pMA->GetType() )
+ {
+ case META_NULL_ACTION :
+ break;
+
+ case META_PIXEL_ACTION :
+ {
+ Color aOldLineColor( aLineColor );
+ aLineColor = ( (const MetaPixelAction*) pMA )->GetColor();
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( ( (const MetaPixelAction*)pMA )->GetPoint() );
+ ImplLineTo( ( (const MetaPixelAction*)pMA )->GetPoint() );
+ ImplPathDraw();
+ aLineColor = aOldLineColor;
+ }
+ break;
+
+ case META_POINT_ACTION :
+ {
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( ( (const MetaPointAction*)pMA )->GetPoint() );
+ ImplLineTo( ( (const MetaPointAction*)pMA )->GetPoint() );
+ ImplPathDraw();
+ }
+ break;
+
+ case META_LINE_ACTION :
+ {
+ const LineInfo& rLineInfo = ( ( const MetaLineAction*)pMA )->GetLineInfo();
+ if ( !rLineInfo.IsDefault() )
+ ImplWriteLineInfo( rLineInfo );
+
+ if ( bLineColor )
+ {
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( ( (const MetaLineAction*) pMA )->GetStartPoint() );
+ ImplLineTo( ( (const MetaLineAction*) pMA )->GetEndPoint() );
+ ImplPathDraw();
+ }
+ if ( !rLineInfo.IsDefault() )
+ ImplWriteLine( "lc ld lw" ); // LineWidth, LineDash, LineCap zuruecksetzen
+ }
+ break;
+
+ case META_RECT_ACTION :
+ {
+ ImplRect( ( (const MetaRectAction*) pMA )->GetRect() );
+ }
+ break;
+
+ case META_ROUNDRECT_ACTION :
+ ImplRect( ( (const MetaRoundRectAction*) pMA )->GetRect() );
+ break;
+
+ case META_ELLIPSE_ACTION :
+ {
+ Rectangle aRect = ( ( (const MetaEllipseAction*) pMA )->GetRect() );
+ Point aCenter = aRect.Center();
+ Polygon aPoly( aCenter, aRect.GetWidth() / 2, aRect.GetHeight() / 2 );
+ ImplPoly( aPoly );
+ }
+ break;
+
+ case META_ARC_ACTION :
+ {
+ Polygon aPoly( ( (const MetaArcAction*)pMA )->GetRect(), ( (const MetaArcAction*)pMA )->GetStartPoint(),
+ ( (const MetaArcAction*)pMA )->GetEndPoint(), POLY_ARC );
+ ImplPoly( aPoly );
+ }
+ break;
+
+ case META_PIE_ACTION :
+ {
+ Polygon aPoly( ( (const MetaPieAction*)pMA )->GetRect(), ( (const MetaPieAction*)pMA )->GetStartPoint(),
+ ( (const MetaPieAction*)pMA )->GetEndPoint(), POLY_PIE );
+ ImplPoly( aPoly );
+ }
+ break;
+
+ case META_CHORD_ACTION :
+ {
+ Polygon aPoly( ( (const MetaChordAction*)pMA )->GetRect(), ( (const MetaChordAction*)pMA )->GetStartPoint(),
+ ( (const MetaChordAction*)pMA )->GetEndPoint(), POLY_CHORD );
+ ImplPoly( aPoly );
+ }
+ break;
+
+ case META_POLYLINE_ACTION :
+ {
+ if ( bLineColor )
+ {
+ const LineInfo& rLineInfo = ( ( const MetaPolyLineAction*)pMA )->GetLineInfo();
+ ImplWriteLineColor( PS_SPACE );
+ if ( !rLineInfo.IsDefault() )
+ ImplWriteLineInfo( rLineInfo );
+ ImplLine( ( (const MetaPolyLineAction*) pMA )->GetPolygon() );
+ ImplPathDraw();
+ if ( !rLineInfo.IsDefault() )
+ ImplWriteLine( "lc ld lw" ); // LineWidth, LineDash, LineCap zuruecksetzen
+ }
+ }
+ break;
+
+ case META_POLYGON_ACTION :
+ {
+ ImplPoly( ( (const MetaPolygonAction*) pMA )->GetPolygon() );
+ }
+ break;
+
+ case META_POLYPOLYGON_ACTION :
+ {
+ ImplLine( ( (const MetaPolyPolygonAction*) pMA )->GetPolyPolygon() );
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ const MetaTextAction * pA = (const MetaTextAction*) pMA;
+
+ String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ Point aPoint( pA->GetPoint() );
+
+ ImplSetAttrForText( aPoint );
+ ByteString aStr( aUniStr, maFont.GetCharSet() );
+ ImplWriteString( aStr );
+ if ( maFont.GetOrientation() )
+ ImplWriteLine( "gr" );
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ {
+ DBG_ERROR( "Unsupported action: TextRect...Action!" );
+ }
+ break;
+
+ case META_STRETCHTEXT_ACTION :
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pMA;
+ String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ Point aPoint( pA->GetPoint() );
+
+ ImplSetAttrForText( aPoint );
+
+ ByteString aStr( aUniStr, maFont.GetCharSet() );
+ ImplWriteString( aStr, NULL, TRUE );
+
+ if ( maFont.GetOrientation() )
+ ImplWriteLine( "gr" );
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pMA;
+ String aUniStr( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ Point aPoint( pA->GetPoint() );
+
+ ImplSetAttrForText( aPoint );
+
+ ByteString aStr( aUniStr, maFont.GetCharSet() );
+ ImplWriteString( aStr, pA->GetDXArray(), FALSE );
+
+ if ( maFont.GetOrientation() )
+ ImplWriteLine( "gr" );
+ }
+ break;
+
+ case META_BMP_ACTION :
+ {
+ Bitmap aBitmap = ( (const MetaBmpAction*)pMA )->GetBitmap();
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Point aPoint = ( (const MetaBmpAction*) pMA )->GetPoint();
+ ImplBmp( &aBitmap, NULL, aPoint, nBoundingX2, nBoundingY2 );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION :
+ {
+ Bitmap aBitmap = ( (const MetaBmpScaleAction*)pMA )->GetBitmap();
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Point aPoint = ( (const MetaBmpScaleAction*) pMA )->GetPoint();
+ Size aSize = ( (const MetaBmpScaleAction*)pMA )->GetSize();
+ ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION :
+ {
+ Bitmap aBitmap( ( (const MetaBmpScalePartAction*)pMA )->GetBitmap() );
+ aBitmap.Crop( Rectangle( ( (const MetaBmpScalePartAction*)pMA )->GetSrcPoint(),
+ ( (const MetaBmpScalePartAction*)pMA )->GetSrcSize() ) );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Point aPoint = ( (const MetaBmpScalePartAction*) pMA)->GetDestPoint();
+ Size aSize = ( (const MetaBmpScalePartAction*)pMA )->GetDestSize();
+ ImplBmp( &aBitmap, NULL, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPEX_ACTION :
+ {
+ BitmapEx aBitmapEx( ( (MetaBmpExAction*)pMA)->GetBitmapEx() );
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Bitmap aMask( aBitmapEx.GetMask() );
+ Point aPoint = ( (const MetaBmpExAction*) pMA)->GetPoint();
+ Size aSize = ( aBitmap.GetSizePixel() );
+ ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION :
+ {
+ BitmapEx aBitmapEx( ( (MetaBmpExScaleAction*)pMA)->GetBitmapEx() );
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Bitmap aMask( aBitmapEx.GetMask() );
+ Point aPoint = ( (const MetaBmpExScaleAction*) pMA)->GetPoint();
+ Size aSize( ( (const MetaBmpExScaleAction*)pMA )->GetSize() );
+ ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION :
+ {
+ BitmapEx aBitmapEx( ( (const MetaBmpExScalePartAction*)pMA )->GetBitmapEx() );
+ aBitmapEx.Crop( Rectangle( ( (const MetaBmpExScalePartAction*)pMA )->GetSrcPoint(),
+ ( (const MetaBmpExScalePartAction*)pMA )->GetSrcSize() ) );
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( mbGrayScale )
+ aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
+ Bitmap aMask( aBitmapEx.GetMask() );
+ Point aPoint = ( (const MetaBmpExScalePartAction*) pMA)->GetDestPoint();
+ Size aSize = ( (const MetaBmpExScalePartAction*)pMA )->GetDestSize();
+ ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
+ }
+ break;
+
+ // Unsupported Actions
+ case META_MASK_ACTION:
+ case META_MASKSCALE_ACTION:
+ case META_MASKSCALEPART_ACTION:
+ {
+ DBG_ERROR( "Unsupported action: MetaMask...Action!" );
+ }
+ break;
+
+ case META_GRADIENT_ACTION :
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+
+ aVDev.SetMapMode( aMapMode );
+ aVDev.AddGradientActions( ( (const MetaGradientAction*)pMA)->GetRect(), ( (const MetaGradientAction*) pMA )->GetGradient(), aTmpMtf );
+ ImplWriteActions( aTmpMtf );
+ }
+ break;
+
+ case META_HATCH_ACTION :
+ {
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+
+ aVDev.SetMapMode( aMapMode );
+ aVDev.AddHatchActions( ( (const MetaHatchAction*)pMA)->GetPolyPolygon(),
+ ( (const MetaHatchAction*)pMA )->GetHatch(), aTmpMtf );
+ ImplWriteActions( aTmpMtf );
+ }
+ break;
+
+ case META_WALLPAPER_ACTION :
+ {
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*)pMA;
+ Rectangle aRect = pA->GetRect();
+ Wallpaper aWallpaper = pA->GetWallpaper();
+
+ if ( aWallpaper.IsBitmap() )
+ {
+ BitmapEx aBitmapEx = aWallpaper.GetBitmap();
+ Bitmap aBitmap( aBitmapEx.GetBitmap() );
+ if ( aBitmapEx.IsTransparent() )
+ {
+ if ( aWallpaper.IsGradient() )
+ {
+
+ // gradient action
+
+ }
+ Bitmap aMask( aBitmapEx.GetMask() );
+ ImplBmp( &aBitmap, &aMask, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() );
+ }
+ else
+ ImplBmp( &aBitmap, NULL, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() );
+
+ // wallpaper Style
+
+ }
+ else if ( aWallpaper.IsGradient() )
+ {
+
+ // gradient action
+
+ }
+ else
+ {
+ aColor = aWallpaper.GetColor();
+ ImplRectFill( aRect );
+ }
+ }
+ break;
+
+ case META_ISECTRECTCLIPREGION_ACTION:
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA;
+ if ( aClipRegion.IsEmpty() )
+ aClipRegion = pA->GetRect();
+ else
+ aClipRegion.Intersect( pA->GetRect() );
+ bRegionChanged = FALSE;
+ ImplSetClipRegion();
+ }
+ break;
+
+ case META_CLIPREGION_ACTION:
+ {
+ const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pMA;
+ bRegionChanged = TRUE;
+ aClipRegion = pA->GetRegion();
+ ImplSetClipRegion();
+ }
+ break;
+
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ {
+ const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pMA;
+ if ( aClipRegion.IsEmpty() )
+ aClipRegion = pA->GetRegion();
+ else
+ aClipRegion.Intersect( pA->GetRegion() );
+ bRegionChanged = TRUE;
+ ImplSetClipRegion();
+ }
+ break;
+
+ case META_MOVECLIPREGION_ACTION:
+ {
+ if ( !aClipRegion.IsEmpty() )
+ {
+ const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pMA;
+ aClipRegion.Move( pA->GetHorzMove(), pA->GetVertMove() );
+ ImplSetClipRegion();
+ }
+ }
+ break;
+
+ case META_LINECOLOR_ACTION :
+ {
+ if ( ( (const MetaLineColorAction*) pMA)->IsSetting() )
+ {
+ bLineColor = TRUE;
+ aLineColor = ( (const MetaLineColorAction*) pMA )->GetColor();
+ }
+ else
+ bLineColor = FALSE;
+ }
+ break;
+
+ case META_FILLCOLOR_ACTION :
+ {
+ if ( ( (const MetaFillColorAction*) pMA )->IsSetting() )
+ {
+ bFillColor = TRUE;
+ aFillColor = ( (const MetaFillColorAction*) pMA )->GetColor();
+ }
+ else
+ bFillColor = FALSE;
+ }
+ break;
+
+ case META_TEXTCOLOR_ACTION :
+ {
+ aTextColor = ( (const MetaTextColorAction*) pMA )->GetColor();
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION :
+ {
+ if ( ( (const MetaTextFillColorAction*) pMA )->IsSetting() )
+ {
+ bTextFillColor = TRUE;
+ aTextFillColor = ( (const MetaTextFillColorAction*) pMA )->GetColor();
+ }
+ else
+ bTextFillColor = FALSE;
+ }
+ break;
+
+ case META_TEXTALIGN_ACTION :
+ {
+ eTextAlign = ( (const MetaTextAlignAction*) pMA )->GetTextAlign();
+ }
+ break;
+
+ case META_MAPMODE_ACTION :
+ {
+ aMapMode = ( (const MetaMapModeAction*) pMA )->GetMapMode();
+
+ if( aMapMode.GetMapUnit() == MAP_RELATIVE )
+ {
+ nXScaling *= (double)aMapMode.GetScaleX();
+ nYScaling *= (double)aMapMode.GetScaleY();
+ nXOrigin += (double)aMapMode.GetOrigin().X() * nXScaling;
+ nYOrigin += (double)aMapMode.GetOrigin().Y() * nYScaling;
+ }
+ else
+ ImplGetMapMode( aMapMode );
+ }
+ break;
+
+ case META_FONT_ACTION :
+ {
+ maFont = ( (const MetaFontAction*) pMA )->GetFont();
+ aOutputDevice.SetFont( maFont );
+ }
+ break;
+
+ case META_PUSH_ACTION :
+ {
+ StackMember* pGS = new StackMember;
+ pGS->pSucc = pGDIStack;
+ pGDIStack = pGS;
+ pGS->eTextAlign = eTextAlign;
+ pGS->aGlobalCol = aColor;
+ pGS->bLineCol = bLineColor;
+ pGS->aLineCol = aLineColor;
+ pGS->bFillCol = bFillColor;
+ pGS->aFillCol = aFillColor;
+ pGS->aTextCol = aTextColor;
+ pGS->bTextFillCol = bTextFillColor;
+ pGS->aTextFillCol = aTextFillColor;
+ pGS->aBackgroundCol = aBackgroundColor;
+ pGS->bRegionChanged = bRegionChanged;
+ pGS->aClipReg = aClipRegion;
+ pGS->aMapMode = aMapMode;
+ bRegionChanged = FALSE;
+ pGS->aFont = maFont;
+ pGS->nXScale = nXScaling;
+ pGS->nYScale = nYScaling;
+ pGS->nXOrig = nXOrigin;
+ pGS->nYOrig = nYOrigin;
+ mnLatestPush = mpPS->Tell();
+ ImplWriteLine( "gs" );
+ }
+ break;
+
+ case META_POP_ACTION :
+ {
+ StackMember* pGS;
+ if( pGDIStack )
+ {
+ pGS = pGDIStack;
+ pGDIStack = pGS->pSucc;
+ if ( aMapMode != pGS->aMapMode )
+ {
+ aMapMode = pGS->aMapMode;
+ ImplGetMapMode( aMapMode );
+ }
+ eTextAlign = pGS->eTextAlign;
+ aColor = pGS->aGlobalCol;
+ bLineColor = pGS->bLineCol;
+ aLineColor = pGS->aLineCol;
+ bFillColor = pGS->bFillCol;
+ aFillColor = pGS->aFillCol;
+ aTextColor = pGS->aTextCol;
+ bTextFillColor = pGS->bTextFillCol;
+ aTextFillColor = pGS->aTextFillCol;
+ aBackgroundColor = pGS->aBackgroundCol;
+ if ( bRegionChanged )
+ {
+ aClipRegion = pGS->aClipReg;
+ ImplSetClipRegion();
+ }
+ bRegionChanged = pGS->bRegionChanged;
+ maFont = pGS->aFont;
+ maLastFont = Font(); // set maLastFont != maFont -> so that
+ nXScaling = pGS->nXScale;
+ nYScaling = pGS->nYScale;
+ nXOrigin = pGS->nXOrig;
+ nYOrigin = pGS->nYOrig;
+ delete pGS;
+ UINT32 nCurrentPos = mpPS->Tell();
+ if ( nCurrentPos - 6 == mnLatestPush )
+ {
+ mpPS->Seek( mnLatestPush );
+ ImplWriteLine( " " );
+ mpPS->Seek( mnLatestPush );
+ }
+ else
+ ImplWriteLine( "gr" );
+ }
+ }
+ break;
+
+ case META_EPS_ACTION :
+ {
+ GfxLink aGfxLink = ( (const MetaEPSAction*) pMA )->GetLink();
+ BOOL bLevelConflict = FALSE;
+ BYTE* pSource = (BYTE*) aGfxLink.GetData();
+ ULONG nSize = aGfxLink.GetDataSize();
+ ULONG nParseThis = POSTSCRIPT_BOUNDINGSEARCH;
+ if ( nSize < 64 ) // assuming eps is larger than 64 bytes
+ pSource = NULL;
+ if ( nParseThis > nSize )
+ nParseThis = nSize;
+
+ if ( pSource && ( mnLevel == 1 ) )
+ {
+ BYTE* pFound = ImplSearchEntry( pSource, (BYTE*)"%%LanguageLevel:", nParseThis - 10, 16 );
+ if ( pFound )
+ {
+ BYTE k, i = 10;
+ pFound += 16;
+ while ( --i )
+ {
+ k = *pFound++;
+ if ( ( k > '0' ) && ( k <= '9' ) )
+ {
+ if ( k != '1' )
+ {
+ bLevelConflict = TRUE;
+ mnLevelWarning++;
+ }
+ break;
+ }
+ }
+ }
+ }
+ if ( !bLevelConflict )
+ {
+ double nBoundingBox[4];
+ if ( pSource && ImplGetBoundingBox( nBoundingBox, pSource, nParseThis ) )
+ {
+ Point aPoint = ( (const MetaEPSAction*) pMA )->GetPoint();
+ Size aSize = ( (const MetaEPSAction*) pMA )->GetSize();
+ double nXScale = (double)aSize.Width() * (double)nXScaling / ( nBoundingBox[ 2 ] - nBoundingBox[ 0 ] );
+ double nYScale = (double)aSize.Height() * (double)nYScaling / ( nBoundingBox[ 3 ] - nBoundingBox[ 1 ] );
+ ImplWriteLine( "gs\n%%BeginDocument:" );
+ ImplWriteDouble( aPoint.X() * nXScaling + nXOrigin );
+ ImplWriteDouble( - ( aPoint.Y() * nYScaling + nYOrigin + nBoundingBox[ 3 ] * nYScale ) );
+ ImplWriteLine( "t" );
+ ImplWriteDouble( nXScale );
+ ImplWriteDouble( nYScale );
+ ImplWriteLine( "scale" );
+ mpPS->Write( pSource, aGfxLink.GetDataSize() );
+ ImplWriteLine( "%%EndDocument\ngr" );
+ }
+ }
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ ImplLine( ( (const 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;
+
+ 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 );
+
+ ImplWriteActions( aTmpMtf );
+ }
+ break;
+ }
+ }
+}
+
+
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplWritePoint( Point nPoint, ULONG nMode )
+{
+ ImplWriteDouble( nPoint.X() * nXScaling + nXOrigin );
+ ImplWriteDouble( nPoint.Y() * nYScaling + nYOrigin, nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplMoveTo( Point nPoint, ULONG nMode )
+{
+ ImplWritePoint( nPoint );
+ ImplWriteByte( 'm' );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplLineTo( Point nPoint, ULONG nMode )
+{
+ ImplWritePoint( nPoint );
+ ImplWriteByte( 'l' );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplLine( const Polygon &rPolygon )
+{
+ USHORT i = 1;
+ USHORT nPointCount = rPolygon.GetSize();
+ if ( nPointCount > 1 )
+ {
+ ImplMoveTo( rPolygon.GetPoint( 0 ) );
+ while ( i < nPointCount )
+ {
+ ImplLineTo( rPolygon.GetPoint( i++ ), PS_SPACE | PS_WRAP );
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplLine( const PolyPolygon &rPolyPolygon )
+{
+ USHORT i, nCount = rPolyPolygon.Count();
+ for ( i = 0; i < nCount; i++ )
+ {
+ if ( bFillColor )
+ {
+ ImplWriteFillColor( PS_SPACE );
+ ImplLine( rPolyPolygon.GetObject( i ) );
+ ImplClosePathFill();
+ }
+ if ( bLineColor )
+ {
+ ImplWriteLineColor( PS_SPACE );
+ ImplLine( rPolyPolygon.GetObject( i ) );
+ ImplClosePathDraw();
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplRect( const Rectangle & rRect )
+{
+ if ( bFillColor )
+ ImplRectFill( rRect );
+ if ( bLineColor )
+ {
+
+ double nWidth = rRect.GetWidth() * nXScaling;
+ double nHeight = rRect.GetHeight() * nYScaling;
+
+ ImplWriteLineColor( PS_SPACE );
+ ImplMoveTo( rRect.TopLeft() );
+ ImplWriteDouble( nWidth );
+ *mpPS << "0 rl 0 ";
+ ImplWriteDouble( nHeight );
+ *mpPS << "rl ";
+ ImplWriteDouble( nWidth );
+ *mpPS << "neg 0 rl ";
+ ImplClosePathDraw();
+ }
+ *mpPS << (BYTE)10;
+ mnCursorPos = 0;
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplRectFill( const Rectangle & rRect )
+{
+ double nWidth = rRect.GetWidth() * nXScaling;
+ double nHeight = rRect.GetHeight() * nYScaling;
+
+ ImplWriteFillColor( PS_SPACE );
+ ImplMoveTo( rRect.TopLeft() );
+ ImplWriteDouble( nWidth );
+ *mpPS << "0 rl 0 ";
+ ImplWriteDouble( nHeight );
+ *mpPS << "rl ";
+ ImplWriteDouble( nWidth );
+ *mpPS << "neg 0 rl ";
+ ImplClosePathFill();
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplPoly( const Polygon & rPoly )
+{
+ if ( rPoly.GetSize() > 1 )
+ {
+ if ( bFillColor )
+ {
+ ImplWriteFillColor( PS_SPACE );
+ ImplLine( rPoly );
+ ImplClosePathFill();
+ }
+ if ( bLineColor )
+ {
+ ImplWriteLineColor( PS_SPACE );
+ ImplLine( rPoly );
+ ImplClosePathDraw();
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplSetClipRegion()
+{
+ if ( !aClipRegion.IsEmpty() )
+ {
+ Rectangle aRect;
+ RegionHandle hRegionHandle = aClipRegion.BeginEnumRects();
+
+ while ( aClipRegion.GetNextEnumRect( hRegionHandle, aRect ) )
+ {
+ double nX1 = aRect.Left() * nXScaling + nXOrigin;
+ double nY1 = aRect.Top() * nYScaling + nYOrigin;
+ double nX2 = aRect.Right() * nXScaling + nXOrigin;
+ double nY2 = aRect.Bottom() * nYScaling + nYOrigin;
+ ImplWriteDouble( nX1 );
+ ImplWriteDouble( nY1 );
+ ImplWriteByte( 'm' );
+ ImplWriteDouble( nX2 );
+ ImplWriteDouble( nY1 );
+ ImplWriteByte( 'l' );
+ ImplWriteDouble( nX2 );
+ ImplWriteDouble( nY2 );
+ ImplWriteByte( 'l' );
+ ImplWriteDouble( nX1 );
+ ImplWriteDouble( nY2 );
+ ImplWriteByte( 'l' );
+ ImplWriteDouble( nX1 );
+ ImplWriteDouble( nY1 );
+ ImplWriteByte( 'l', PS_SPACE | PS_WRAP );
+ };
+ aClipRegion.EndEnumRects( hRegionHandle );
+ ImplWriteLine( "eoclip newpath" );
+ }
+}
+
+//---------------------------------------------------------------------------------
+// possible gfx formats:
+//
+// level 1: grayscale 8 bit
+// color 24 bit
+//
+// level 2: grayscale 8 bit
+// color 1(pal), 4(pal), 8(pal), 24 Bit
+//
+
+void PSWriter::ImplBmp( Bitmap* pBitmap, Bitmap* pMaskBitmap, const Point & rPoint, double nXWidth, double nYHeightOrg )
+{
+ if ( !pBitmap )
+ return;
+
+ INT32 nHeightOrg = pBitmap->GetSizePixel().Height();
+ INT32 nHeightLeft = nHeightOrg;
+ long nWidth = pBitmap->GetSizePixel().Width();
+ Point aSourcePos( rPoint );
+
+ while ( nHeightLeft )
+ {
+ Bitmap aTileBitmap( *pBitmap );
+ long nHeight = nHeightLeft;
+ double nYHeight = nYHeightOrg;
+
+ BOOL bDoTrans = FALSE;
+
+ Rectangle aRect;
+ Region aRegion;
+
+ if ( pMaskBitmap )
+ {
+ bDoTrans = TRUE;
+ while (TRUE)
+ {
+ if ( mnLevel == 1 )
+ {
+ if ( nHeight > 10 )
+ nHeight = 8;
+ }
+ aRect = Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( (long)nWidth, (long)nHeight ) );
+ aRegion = Region( pMaskBitmap->CreateRegion( COL_BLACK, aRect ) );
+
+ if ( ( mnLevel == 1 ) && ( aRegion.GetRectCount() * 5 > 1000 ) )
+ {
+ nHeight >>= 1;
+ if ( nHeight < 2 )
+ return;
+ continue;
+ }
+ break;
+ }
+ }
+ if ( nHeight != nHeightOrg )
+ {
+ nYHeight = nYHeightOrg * nHeight / nHeightOrg;
+ aTileBitmap.Crop( Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( nWidth, nHeight ) ) );
+ }
+ if ( bDoTrans )
+ {
+ ImplWriteLine( "gs\npum" );
+ ImplWriteDouble( aSourcePos.X() * nXScaling + nXOrigin );
+ ImplWriteDouble( -aSourcePos.Y() * nYScaling - nYOrigin );
+ ImplWriteLine( "t" );
+ ImplWriteDouble( nXWidth * nXScaling / nWidth );
+ ImplWriteDouble( nYHeight * nYScaling / nHeight );
+ ImplWriteLine( "scale" );
+
+ if ( !aClipRegion.IsEmpty() )
+ {
+ // aRegion.Intersect( aClipRegion );
+ }
+ RegionHandle hRegionHandle = aRegion.BeginEnumRects();
+
+ while ( aRegion.GetNextEnumRect( hRegionHandle, aRect ) )
+ {
+ aRect.Move( 0, - ( nHeightOrg - nHeightLeft ) );
+ ImplWriteLong( aRect.Left() );
+ ImplWriteLong( aRect.Top() );
+ ImplWriteByte( 'm' );
+ ImplWriteLong( aRect.Right() + 1 );
+ ImplWriteLong( aRect.Top() );
+ ImplWriteByte( 'l' );
+ ImplWriteLong( aRect.Right() + 1 );
+ ImplWriteLong( aRect.Bottom() + 1 );
+ ImplWriteByte( 'l' );
+ ImplWriteLong( aRect.Left() );
+ ImplWriteLong( aRect.Bottom() + 1 );
+ ImplWriteByte( 'l' );
+ ImplWriteByte( 'p', PS_SPACE | PS_WRAP );
+ };
+ aRegion.EndEnumRects( hRegionHandle );
+ ImplWriteLine( "eoclip newpath" );
+ ImplWriteLine( "pom" );
+ }
+ BitmapReadAccess* pAcc = aTileBitmap.AcquireReadAccess();
+
+ if (!bDoTrans )
+ ImplWriteLine( "pum" );
+
+ ImplWriteDouble( aSourcePos.X() * nXScaling + nXOrigin );
+ ImplWriteDouble( -aSourcePos.Y() * nYScaling - nYOrigin - nYHeight * nYScaling );
+ ImplWriteLine( "t" );
+ ImplWriteDouble( nXWidth * nXScaling );
+ ImplWriteDouble( nYHeight * nYScaling );
+ ImplWriteLine( "scale" );
+ if ( mnLevel == 1 ) // level 1 is always grayscale !!!
+ {
+ ImplWriteLong( nWidth );
+ ImplWriteLong( nHeight );
+ *mpPS << "8 [";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0 );
+ ImplWriteLong( nHeight );
+ ImplWriteLine( "]" );
+ *mpPS << "{currentfile ";
+ ImplWriteLong( nWidth );
+ ImplWriteLine( "string readhexstring pop}" );
+ ImplWriteLine( "image" );
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ *mpPS << (BYTE)10;
+ }
+ else // Level 2
+ {
+ if ( mbGrayScale )
+ {
+ ImplWriteLine( "/DeviceGray setcolorspace" );
+ ImplWriteLine( "<<" );
+ ImplWriteLine( "/ImageType 1" );
+ *mpPS << "/Width ";
+ ImplWriteLong( nWidth, PS_RET );
+ *mpPS << "/Height ";
+ ImplWriteLong( nHeight, PS_RET );
+ ImplWriteLine( "/BitsPerComponent 8" );
+ ImplWriteLine( "/Decode[0 1]" );
+ *mpPS << "/ImageMatrix[";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0 );
+ ImplWriteLong( nHeight, PS_NONE );
+ ImplWriteByte( ']', PS_RET );
+ ImplWriteLine( "/DataSource currentfile" );
+ ImplWriteLine( "/ASCIIHexDecode filter" );
+ if ( mbCompression )
+ ImplWriteLine( "/LZWDecode filter" );
+ ImplWriteLine( ">>" );
+ ImplWriteLine( "image" );
+ if ( mbCompression )
+ {
+ StartCompression();
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ Compress( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ EndCompression();
+ }
+ else
+ {
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ }
+ else
+ {
+ // have we to write a palette ?
+
+ if ( pAcc->HasPalette() )
+ {
+ ImplWriteLine( "[/Indexed /DeviceRGB " );
+ ImplWriteLong( pAcc->GetPaletteEntryCount() - 1, PS_RET );
+ ImplWriteByte( '<', PS_NONE );
+ for ( USHORT i = 0; i < pAcc->GetPaletteEntryCount(); i++ )
+ {
+ BitmapColor aBitmapColor = pAcc->GetPaletteColor( i );
+ ImplWriteHexByte( aBitmapColor.GetRed(), PS_NONE );
+ ImplWriteHexByte( aBitmapColor.GetGreen(), PS_NONE );
+ ImplWriteHexByte( aBitmapColor.GetBlue(), PS_SPACE | PS_WRAP );
+ }
+ ImplWriteByte( '>', PS_RET );
+
+ ImplWriteLine( "] setcolorspace" );
+ ImplWriteLine( "<<" );
+ ImplWriteLine( "/ImageType 1" );
+ *mpPS << "/Width ";
+ ImplWriteLong( nWidth, PS_RET );
+ *mpPS << "/Height ";
+ ImplWriteLong( nHeight, PS_RET );
+ ImplWriteLine( "/BitsPerComponent 8" );
+ ImplWriteLine( "/Decode[0 255]" );
+ *mpPS << "/ImageMatrix[";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0);
+ ImplWriteLong( nHeight, PS_NONE );
+ ImplWriteByte( ']', PS_RET );
+ ImplWriteLine( "/DataSource currentfile" );
+ ImplWriteLine( "/ASCIIHexDecode filter" );
+ if ( mbCompression )
+ ImplWriteLine( "/LZWDecode filter" );
+ ImplWriteLine( ">>" );
+ ImplWriteLine( "image" );
+ if ( mbCompression )
+ {
+ StartCompression();
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ Compress( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ EndCompression();
+ }
+ else
+ {
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ ImplWriteHexByte( (BYTE)pAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ }
+ else // 24 bit color
+ {
+ ImplWriteLine( "/DeviceRGB setcolorspace" );
+ ImplWriteLine( "<<" );
+ ImplWriteLine( "/ImageType 1" );
+ *mpPS << "/Width ";
+ ImplWriteLong( nWidth, PS_RET );
+ *mpPS << "/Height ";
+ ImplWriteLong( nHeight, PS_RET );
+ ImplWriteLine( "/BitsPerComponent 8" );
+ ImplWriteLine( "/Decode[0 1 0 1 0 1]" );
+ *mpPS << "/ImageMatrix[";
+ ImplWriteLong( nWidth );
+ *mpPS << "0 0 ";
+ ImplWriteLong( -nHeight );
+ ImplWriteLong( 0 );
+ ImplWriteLong( nHeight, PS_NONE );
+ ImplWriteByte( ']', PS_RET );
+ ImplWriteLine( "/DataSource currentfile" );
+ ImplWriteLine( "/ASCIIHexDecode filter" );
+ if ( mbCompression )
+ ImplWriteLine( "/LZWDecode filter" );
+ ImplWriteLine( ">>" );
+ ImplWriteLine( "image" );
+ if ( mbCompression )
+ {
+ StartCompression();
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) );
+ Compress( aBitmapColor.GetRed() );
+ Compress( aBitmapColor.GetGreen() );
+ Compress( aBitmapColor.GetBlue() );
+ }
+ }
+ EndCompression();
+ }
+ else
+ {
+ for ( long y = 0; y < nHeight; y++ )
+ {
+ for ( long x = 0; x < nWidth; x++ )
+ {
+ const BitmapColor aBitmapColor( pAcc->GetPixel( y, x ) );
+ ImplWriteHexByte( aBitmapColor.GetRed() );
+ ImplWriteHexByte( aBitmapColor.GetGreen() );
+ ImplWriteHexByte( aBitmapColor.GetBlue() );
+ }
+ }
+ }
+ }
+ }
+ ImplWriteLine( ">" ); // in Level 2 the dictionary needs to be closed (eod)
+ }
+ if ( bDoTrans )
+ ImplWriteLine( "gr" );
+ else
+ ImplWriteLine( "pom" );
+
+ aTileBitmap.ReleaseAccess( pAcc );
+ nHeightLeft -= nHeight;
+ if ( nHeightLeft )
+ {
+ nHeightLeft++;
+ aSourcePos.Y() = (long) ( rPoint.Y() + ( nYHeightOrg * ( nHeightOrg - nHeightLeft ) ) / nHeightOrg );
+ }
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteCharacter( sal_Char nChar )
+{
+ switch( nChar )
+ {
+ case '(' :
+ case ')' :
+ case '\\' :
+ ImplWriteByte( (BYTE)'\\', PS_NONE );
+ }
+ ImplWriteByte( (BYTE)nChar, PS_NONE );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteString( const ByteString& rString, const INT32* pDXArry, BOOL bStretch )
+{
+ USHORT nLen = rString.Len();
+ if ( nLen )
+ {
+ USHORT i;
+ if ( pDXArry )
+ {
+ double nx = 0;
+
+ for( i = 0; i < nLen; i++ )
+ {
+ if ( i > 0 )
+ nx = pDXArry[ i - 1 ] * nXScaling;
+ ImplWriteDouble( ( bStretch ) ? nx : aOutputDevice.GetTextWidth( rString.GetChar( i ) ) * nXScaling );
+ ImplWriteDouble( nx );
+ ImplWriteLine( "(", PS_NONE );
+ ImplWriteCharacter( rString.GetChar( i ) );
+ ImplWriteLine( ") bs" );
+ }
+ }
+ else
+ {
+ ImplWriteByte( '(', PS_NONE );
+ for ( i = 0; i < nLen; i++ )
+ ImplWriteCharacter( rString.GetChar( i ) );
+ ImplWriteLine( ") s" );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::ImplSetAttrForText( Point & aPoint )
+{
+ long nRotation = maFont.GetOrientation();
+ ImplWriteTextColor();
+
+ Size aSize = maFont.GetSize();
+
+ if ( maLastFont != maFont )
+ {
+ if ( maFont.GetPitch() == PITCH_FIXED ) // a little bit font selection
+ ImplDefineFont( "Courier", "Oblique" );
+ else if ( maFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
+ ImplWriteLine( "/Symbol findfont" );
+ else if ( maFont.GetFamily() == FAMILY_SWISS )
+ ImplDefineFont( "Helvetica", "Oblique" );
+ else
+ ImplDefineFont( "Times", "Italic" );
+
+ maLastFont = maFont;
+ aSize = maFont.GetSize();
+ ImplWriteDouble( aSize.Height() * nYScaling ); ///???????????????????
+ *mpPS << "sf ";
+ }
+ if ( eTextAlign != ALIGN_BASELINE )
+ { // PostScript kennt kein FontAlignment
+ if ( eTextAlign == ALIGN_TOP ) // -> ich gehe daher davon aus, dass
+ aPoint.Y() += ( aSize.Height() * 4 / 5 ); // der Bereich unter der Baseline
+ else if ( eTextAlign == ALIGN_BOTTOM ) // in etwa 20% der Fontsize ausmacht
+ aPoint.Y() -= ( aSize.Height() / 5 );
+ }
+ ImplMoveTo( aPoint );
+ if ( nRotation )
+ {
+ *mpPS << "gs ";
+ ImplWriteF( nRotation, 1 );
+ *mpPS << "r ";
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplDefineFont( char* pOriginalName, char* pItalic )
+{
+ *mpPS << (BYTE)'/'; //convert the font pOriginalName using ISOLatin1Encoding
+ *mpPS << pOriginalName;
+ switch ( maFont.GetWeight() )
+ {
+ case WEIGHT_SEMIBOLD :
+ case WEIGHT_BOLD :
+ case WEIGHT_ULTRABOLD :
+ case WEIGHT_BLACK :
+ *mpPS << "-Bold";
+ if ( maFont.GetItalic() != ITALIC_NONE )
+ *mpPS << pItalic;
+ break;
+ default:
+ if ( maFont.GetItalic() != ITALIC_NONE )
+ *mpPS << pItalic;
+ break;
+ }
+ ImplWriteLine( " f" );
+}
+
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplClosePathFill( ULONG nMode )
+{
+ *mpPS << "pf";
+ mnCursorPos += 2;
+ ImplExecMode( nMode );
+}
+
+void PSWriter::ImplClosePathDraw( ULONG nMode )
+{
+ *mpPS << "pc";
+ mnCursorPos += 2;
+ ImplExecMode( nMode );
+}
+
+void PSWriter::ImplPathDraw( ULONG nMode )
+{
+ *mpPS << "ps";
+ mnCursorPos += 2;
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplWriteLineColor( ULONG nMode )
+{
+ if ( aColor != aLineColor )
+ {
+ aColor = aLineColor;
+ ImplWriteColor( nMode );
+ }
+}
+inline void PSWriter::ImplWriteFillColor( ULONG nMode )
+{
+ if ( aColor != aFillColor )
+ {
+ aColor = aFillColor;
+ ImplWriteColor( nMode );
+ }
+}
+inline void PSWriter::ImplWriteTextColor( ULONG nMode )
+{
+ if ( aColor != aTextColor )
+ {
+ aColor = aTextColor;
+ ImplWriteColor( nMode );
+ }
+}
+inline void PSWriter::ImplWriteTextFillColor( ULONG nMode )
+{
+ if ( aColor != aTextFillColor )
+ {
+ aColor = aTextFillColor;
+ ImplWriteColor( nMode );
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteColor( ULONG nMode )
+{
+ if ( mbGrayScale )
+ {
+ // writes the Color (grayscale) as a Number from 0.000 up to 1.000
+
+ ImplWriteF( 1000 * ( (BYTE)aColor.GetRed() * 77 + (BYTE)aColor.GetGreen() * 151 +
+ (BYTE)aColor.GetBlue() * 28 + 1 ) / 65536, 3, nMode );
+ }
+ else
+ {
+ ImplWriteB1 ( (BYTE)aColor.GetRed() );
+ ImplWriteB1 ( (BYTE)aColor.GetGreen() );
+ ImplWriteB1 ( (BYTE)aColor.GetBlue() );
+ }
+ *mpPS << "c"; // ( c is defined as setrgbcolor or setgray )
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplGetMapMode( const MapMode& aMapMode )
+{
+ aOutputDevice.SetMapMode( aMapMode );
+ double nMul;
+ switch ( aMapMode.GetMapUnit() )
+ {
+ case MAP_PIXEL :
+ case MAP_SYSFONT :
+ case MAP_APPFONT :
+
+ case MAP_100TH_MM :
+ nMul = 1 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_10TH_MM :
+ nMul = 10 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_MM :
+ nMul = 100 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_CM :
+ nMul = 1000 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_1000TH_INCH :
+ nMul = 2.54 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_100TH_INCH :
+ nMul = 25.4 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_10TH_INCH :
+ nMul = 254 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_INCH :
+ nMul = 2540 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_TWIP :
+ nMul = 1,76388889 * EPS_SCALING_FAKTOR;
+ break;
+ case MAP_POINT :
+ nMul = 35,27777778 * EPS_SCALING_FAKTOR;
+ break;
+ default:
+ // that does not look right
+ break;
+ }
+ nXOrigin = aMapMode.GetOrigin().X() * nMul;
+ nYOrigin = aMapMode.GetOrigin().Y() * nMul;
+ double nScale = aMapMode.GetScaleX();
+ nXScaling = nMul * nScale;
+ nScale = aMapMode.GetScaleY();
+ nYScaling = nMul * nScale;
+}
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplExecMode( ULONG nMode )
+{
+ if ( nMode & PS_WRAP )
+ {
+ if ( mnCursorPos >= PS_LINESIZE )
+ {
+ mnCursorPos = 0;
+ *mpPS << (BYTE)0xa;
+ return;
+ }
+ }
+ if ( nMode & PS_SPACE )
+ {
+ *mpPS << (BYTE)32;
+ mnCursorPos++;
+ }
+ if ( nMode & PS_RET )
+ {
+ *mpPS << (BYTE)0xa;
+ mnCursorPos = 0;
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+inline void PSWriter::ImplWriteLine( char pString[], ULONG nMode )
+{
+ ULONG i = 0;
+ while ( pString[ i ] )
+ {
+ *mpPS << (BYTE)pString[ i++ ];
+ }
+ mnCursorPos += i;
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
+{
+ double fLineWidth = ( ( rLineInfo.GetWidth() + 1 ) * nXScaling + ( rLineInfo.GetWidth() + 1 ) * nYScaling ) * 0.5;
+ ImplWriteLine( "cl", PS_SPACE ); // currentLineWidth & currentDash auf den Stack
+ ImplWriteDouble( fLineWidth );
+ ImplWriteLine( " lw", PS_SPACE );
+ if ( rLineInfo.GetStyle() == LINE_DASH )
+ {
+ ImplWriteLine( "[ 2 ] 1 ld" );
+ }
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteLong( sal_Int32 nNumber, ULONG nMode )
+{
+ const ByteString aNumber( ByteString::CreateFromInt32( nNumber ) );
+ ULONG nLen = aNumber.Len();
+ mnCursorPos += nLen;
+ for ( USHORT n = 0; n < nLen; n++ )
+ *mpPS << aNumber.GetChar( n );
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteDouble( double fNumber, ULONG nMode )
+{
+ sal_Int32 n, nLen;
+
+ sal_Int32 nPTemp = (sal_Int32)fNumber;
+ sal_Int32 nATemp = abs( ( fNumber - nPTemp ) * 100000 );
+
+ if ( !nPTemp && nATemp && ( fNumber < 0.0 ) )
+ *mpPS << (sal_Char)'-';
+
+ ByteString aNumber1( ByteString::CreateFromInt32( nPTemp ) );
+ nLen = aNumber1.Len();
+ mnCursorPos += nLen;
+ for ( n = 0; n < nLen; n++ )
+ *mpPS << aNumber1.GetChar( n );
+
+ int zCount = 0;
+ if ( nATemp )
+ {
+ *mpPS << (BYTE)'.';
+ mnCursorPos++;
+ const ByteString aNumber2( ByteString::CreateFromInt32( nATemp ) );
+
+ ULONG nLen = aNumber2.Len();
+ if ( nLen < 8 )
+ {
+ mnCursorPos += 6 - nLen;
+ for ( n = 0; n < ( 5 - nLen ); n++ )
+ {
+ *mpPS << (BYTE)'0';
+ }
+ }
+ mnCursorPos += nLen;
+ for ( USHORT n = 0; n < nLen; n++ )
+ {
+ *mpPS << aNumber2.GetChar( n );
+ zCount--;
+ if ( aNumber2.GetChar( n ) != '0' )
+ zCount = 0;
+ }
+ if ( zCount )
+ mpPS->SeekRel( zCount );
+ }
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+// writes the number to stream: nNumber / ( 10^nCount )
+
+void PSWriter::ImplWriteF( sal_Int32 nNumber, ULONG nCount, ULONG nMode )
+{
+ if ( nNumber < 0 )
+ {
+ *mpPS << (BYTE)'-';
+ nNumber = -nNumber;
+ mnCursorPos++;
+ }
+ const ByteString aScaleFactor( ByteString::CreateFromInt32( nNumber ) );
+ ULONG nLen = aScaleFactor.Len();
+ long nStSize = ( nCount + 1 ) - nLen;
+ if ( nStSize >= 1 )
+ {
+ *mpPS << (BYTE)'0';
+ mnCursorPos++;
+ }
+ if ( nStSize >= 2 )
+ {
+ *mpPS << (BYTE)'.';
+ for ( long i = 1; i < nStSize; i++ )
+ {
+ *mpPS << (BYTE)'0';
+ mnCursorPos++;
+ }
+ }
+ mnCursorPos += nLen;
+ for( USHORT n = 0UL; n < nLen; n++ )
+ {
+ if ( n == nLen - nCount )
+ {
+ *mpPS << (BYTE)'.';
+ mnCursorPos++;
+ }
+ *mpPS << aScaleFactor.GetChar( n );
+ }
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteByte( BYTE nNumb, ULONG nMode )
+{
+ *mpPS << ( nNumb );
+ mnCursorPos++;
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+void PSWriter::ImplWriteHexByte( BYTE nNumb, ULONG nMode )
+{
+ if ( ( nNumb >> 4 ) > 9 )
+ *mpPS << (BYTE)( ( nNumb >> 4 ) + 'A' - 10 );
+ else
+ *mpPS << (BYTE)( ( nNumb >> 4 ) + '0' );
+
+ if ( ( nNumb & 0xf ) > 9 )
+ *mpPS << (BYTE)( ( nNumb & 0xf ) + 'A' - 10 );
+ else
+ *mpPS << (BYTE)( ( nNumb & 0xf ) + '0' );
+ mnCursorPos += 2;
+ ImplExecMode( nMode );
+}
+
+//---------------------------------------------------------------------------------
+
+// writes the BYTE nNumb as a Number from 0.000 up to 1.000
+
+void PSWriter::ImplWriteB1( BYTE nNumb, ULONG nMode )
+{
+ ImplWriteF( 1000 * ( nNumb + 1 ) / 256 , 3, nMode );
+}
+
+
+// ------------------------------------------------------------------------
+
+inline void PSWriter::WriteBits( USHORT nCode, USHORT nCodeLen )
+{
+ dwShift |= ( nCode << ( nOffset - nCodeLen ) );
+ nOffset -= nCodeLen;
+ while ( nOffset < 24 )
+ {
+ ImplWriteHexByte( (BYTE)( dwShift >> 24 ) );
+ dwShift <<= 8;
+ nOffset += 8;
+ }
+ if ( nCode == 257 && nOffset != 32 )
+ ImplWriteHexByte( (BYTE)( dwShift >> 24 ) );
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::StartCompression()
+{
+ USHORT i;
+ nDataSize = 8;
+
+ nClearCode = 1 << nDataSize;
+ nEOICode = nClearCode + 1;
+ nTableSize = nEOICode + 1;
+ nCodeSize = nDataSize + 1;
+
+ nOffset = 32; // anzahl freier bits in dwShift
+ dwShift = 0;
+
+ pTable = new PSLZWCTreeNode[ 4096 ];
+
+ for ( i = 0; i < 4096; i++ )
+ {
+ pTable[ i ].pBrother = pTable[ i ].pFirstChild = NULL;
+ pTable[ i ].nValue = (BYTE)( pTable[ i ].nCode = i );
+ }
+ pPrefix = NULL;
+ WriteBits( nClearCode, nCodeSize );
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::Compress( BYTE nCompThis )
+{
+ PSLZWCTreeNode* p;
+ USHORT i;
+ BYTE nV;
+
+ if( !pPrefix )
+ {
+ pPrefix = pTable + nCompThis;
+ }
+ else
+ {
+ nV = nCompThis;
+ for( p = pPrefix->pFirstChild; p != NULL; p = p->pBrother )
+ {
+ if ( p->nValue == nV )
+ break;
+ }
+
+ if( p )
+ pPrefix = p;
+ else
+ {
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ if ( nTableSize == 409 )
+ {
+ WriteBits( nClearCode, nCodeSize );
+
+ for ( i = 0; i < nClearCode; i++ )
+ pTable[ i ].pFirstChild = NULL;
+
+ nCodeSize = nDataSize + 1;
+ nTableSize = nEOICode + 1;
+ }
+ else
+ {
+ if( nTableSize == (USHORT)( ( 1 << nCodeSize ) - 1 ) )
+ nCodeSize++;
+
+ p = pTable + ( nTableSize++ );
+ p->pBrother = pPrefix->pFirstChild;
+ pPrefix->pFirstChild = p;
+ p->nValue = nV;
+ p->pFirstChild = NULL;
+ }
+
+ pPrefix = pTable + nV;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void PSWriter::EndCompression()
+{
+ if( pPrefix )
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ WriteBits( nEOICode, nCodeSize );
+ delete[] pTable;
+}
+
+// ------------------------------------------------------------------------
+
+BYTE* PSWriter::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;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PSWriter::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;
+}
+
+//================== GraphicExport - die exportierte Funktion ================
+
+#ifdef WNT
+extern "C" BOOL _cdecl GraphicExport(SvStream & rStream, Graphic & rGraphic,
+ PFilterCallback pCallback, void * pCallerData,
+ Config* pOptionsConfig, BOOL)
+#else
+extern "C" BOOL GraphicExport(SvStream & rStream, Graphic & rGraphic,
+ PFilterCallback pCallback, void * pCallerData,
+ Config* pOptionsConfig, BOOL)
+#endif
+{
+ PSWriter aPSWriter;
+ return aPSWriter.WritePS( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+//---------------------------------------------------------------------------------
+
+extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara )
+{
+ BOOL bRet = FALSE;
+
+ if ( rPara.pWindow && rPara.pCfg )
+ {
+ ByteString aResMgrName( "eps" );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if( pResMgr )
+ {
+ rPara.pResMgr = pResMgr;
+ bRet = ( DlgExportEPS( rPara ).Execute() == RET_OK );
+ delete pResMgr;
+ }
+ else
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+//================== ein bischen Muell fuer Windows ==========================
+
+#pragma hdrstop
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0; // HANDLE der DLL
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+#ifndef WNT
+ if ( nHeap )
+ UnlockData( 0 );
+#endif
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/eps/epsstr.src b/goodies/source/filter.vcl/eps/epsstr.src
new file mode 100644
index 000000000000..ef340c7af28e
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/epsstr.src
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * $RCSfile: epsstr.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 "strings.hrc"
+
+// Key fuer den Dialog
+String KEY_PREVIEW
+{
+ Text = "EPS Vorschaubild";
+ Text[ ENGLISH ] = "EPS preview";
+ Text[ italian ] = "Anteprima immagine EPS";
+ Text[ portuguese_brazilian ] = "EPS Vorschaubild";
+ Text[ portuguese ] = "Imagem de previsualização EPS";
+ Text[ danish ] = "EPS eksempelbillede";
+ Text[ french ] = "Aperçu EPS";
+ Text[ swedish ] = "EPS förhandsvisningsbild";
+ Text[ dutch ] = "EPS Voorbeeld";
+ Text[ spanish ] = "Previsualización EPS";
+ Text[ english_us ] = "EPS preview image";
+ Text[ chinese_simplified ] = "EPS Ô¤ÊÓͼ";
+ Text[ russian ] = "Ïðîñìîòð êàðòèíêè EPS";
+ Text[ polish ] = "Podgl¹d EPS";
+ Text[ japanese ] = "EPS ÌßÚËÞ°²Ò°¼Þ";
+ Text[ greek ] = "Åéêüíá ðñïåðéóêüðçóçò EPS";
+ Text[ korean ] = "EPS ¹Ì¸® º¸±â À̹ÌÁö";
+ Text[ chinese_traditional ] = "EPS À˵ø¹Ï";
+ Text[ arabic ] = "ÕæÑÉ ÇáãÚÇíäÉ EPS";
+ Text[ turkish ] = "EPS önizleme resmi";
+ Text[ language_user1 ] = " ";
+};
+String KEY_VERSION
+{
+ Text = "EPS Version";
+ Text[ ENGLISH ] = "EPS version";
+ Text[ italian ] = "Versione EPS";
+ Text[ portuguese_brazilian ] = "EPS Version";
+ Text[ portuguese ] = "Versão EPS";
+ Text[ danish ] = "EPS version";
+ Text[ french ] = "Version EPS";
+ Text[ swedish ] = "EPS version";
+ Text[ dutch ] = "EPS versie";
+ Text[ spanish ] = "Versión EPS";
+ Text[ english_us ] = "EPS version";
+ Text[ chinese_simplified ] = "EPS °æ±¾";
+ Text[ russian ] = "Âåðñèÿ EPS";
+ Text[ polish ] = "Wersja EPS";
+ Text[ japanese ] = "EPS ÊÞ°¼Þ®Ý";
+ Text[ greek ] = "¸êäïóç EPS";
+ Text[ korean ] = "EPS ¹öÀü";
+ Text[ chinese_traditional ] = "EPS ª©¥»";
+ Text[ arabic ] = "EPS ÅÕÏÇÑ";
+ Text[ turkish ] = "EPS sürümü";
+ Text[ language_user1 ] = " ";
+};
+String KEY_COLOR
+{
+ Text = "EPS Farb-Format";
+ Text[ ENGLISH ] = "EPS color format";
+ Text[ italian ] = "Formato colore EPS";
+ Text[ portuguese_brazilian ] = "EPS Farb-Format";
+ Text[ portuguese ] = "Formato de cor EPS";
+ Text[ danish ] = "EPS farveformat";
+ Text[ french ] = "Format de couleur EPS";
+ Text[ swedish ] = "EPS färgformat";
+ Text[ dutch ] = "EPS kleuropmaak";
+ Text[ spanish ] = "Formato de color EPS";
+ Text[ english_us ] = "EPS color format";
+ Text[ chinese_simplified ] = "EPS ÑÕÉ«¸ñʽ";
+ Text[ russian ] = "Ôîðìàò öâåòà EPS";
+ Text[ polish ] = "Format koloru EPS";
+ Text[ japanese ] = "EPS F‚Ì‘Ž®";
+ Text[ greek ] = "ÌïñöÞ ÷ñþìáôïò EPS";
+ Text[ korean ] = "EPS »ö ¼½Ä";
+ Text[ chinese_traditional ] = "EPS ÃC¦â®æ¦¡";
+ Text[ arabic ] = "EPS ÊäÓíÞ ÇáÃáæÇä";
+ Text[ turkish ] = "EPS renk formatý";
+ Text[ language_user1 ] = " ";
+};
+String KEY_COMPR
+{
+ Text = "EPS Kompressionart";
+ Text[ ENGLISH ] = "EPS compression type";
+ Text[ italian ] = "Tipo di compressione EPS";
+ Text[ portuguese_brazilian ] = "EPS Kompressionart";
+ Text[ portuguese ] = "Modo de compressão EPS";
+ Text[ danish ] = "EPS kompressionstype";
+ Text[ french ] = "Type de compression EPS";
+ Text[ swedish ] = "EPS kompressionssätt";
+ Text[ dutch ] = "EPS compressietype";
+ Text[ spanish ] = "Tipo de compresión EPS";
+ Text[ english_us ] = "EPS compression mode";
+ Text[ chinese_simplified ] = "EPS ѹËõ·½Ê½";
+ Text[ russian ] = "Òèï óæàòèÿ EPS";
+ Text[ polish ] = "Tryb kompresji EPS";
+ Text[ japanese ] = "EPS ˆ³kÓ°ÄÞ";
+ Text[ greek ] = "Ôýðïò óõìðßåóçò EPS";
+ Text[ korean ] = "EPS ¾ÐÃà ¸ðµå";
+ Text[ chinese_traditional ] = "EPS À£ÁY¤è¦¡";
+ Text[ arabic ] = "EPS ØÑíÞÉ ÇáÖÛØ";
+ Text[ turkish ] = "EPS sýkýþtýrma türü";
+ Text[ language_user1 ] = " ";
+};
+
+String KEY_VERSION_CHECK
+{
+ Text = "Achtung: Es konnten nicht alle importierte EPS-Grafiken in Level1 abgespeichert werden,\n"
+ "da einige in einem höherem Level vorliegen !";
+ Text[ ENGLISH ] = "Attention: It was not possible to save all imported EPS graphics in level1,"
+ "because some of them already attend to a higher level !";
+ Text[ italian ] = "Attenzione: non è stato possibile salvare tutte le immagini EPS importate nel livello1\nin quanto ne esistono alcune in un livello superiore!";
+ Text[ portuguese_brazilian ] = "Achtung: Es konnten nicht alle importierte EPS-Grafiken in Level1 abgespeichert werden,\nda einige in einem höherem Level vorliegen !";
+ Text[ portuguese ] = "Atenção: foi impossível guardar todas as imagens EPS importadas no nível 1,\numa vez que algumas se encontram num nível superior!";
+ Text[ danish ] = "Advarsel: Det var ikke muligt at gemme alle importerede EPS-billeder på niveau1,\nfordi nogle foreligger på et højere niveau !";
+ Text[ french ] = "Attention : Les graphiques EPS importés n'ont pas tous pu être enregistrés au niveau1\ncar certains d'entre eux sont d'un niveau supérieur !";
+ Text[ swedish ] = "OBS: Alla importerade EPS-grafiker kunde inte sparas på Level1,\neftersom en del finns på en högre nivå !";
+ Text[ dutch ] = "Pas op: Niet alle geïmporteerde EPS-afbeeldingen konden onder Level1 worden opgeslagen,\ndaar enkele ervan op een hoger level liggen !";
+ Text[ spanish ] = "¡Atención: No han podido ser guardados en Level1 todos los gráficos EPS importados\nporque existen algunos en un nivel más alto!";
+ Text[ english_us ] = "Warning: Not all of the imported EPS graphics could be saved at level1\nas some are at a higher level!";
+ Text[ chinese_simplified ] = "×¢Òâ: ÎÞ·¨½«ËùÓеÄÊäÈëͼÐÎÒÔ¡°¼¶±ð 1¡±´æÅÌ£¬\nÒòΪһЩͼÐÎÊǸßÓÚ¡°¼¶±ð 1¡± £¡";
+ Text[ russian ] = "Âíèìàíèå! Ñîõðàíèòü âñå èìïîðòèðîâàííûå èçîáðàæåíèÿ EPS íà óðîâíå 1 íåâîçìîæíî,\nòàê êàê íåêîòîðûå èç íèõ íàõîäÿòñÿ íà áîëåå âûñîêîì óðîâíå !";
+ Text[ polish ] = "Uwaga: Nie wszystkie importowane grafiki EPS mog³y zostaæ zapisane na poziomie1, \nponiewa¿ niektóre znajduj¹ siê na wy¿szym poziomie!";
+ Text[ japanese ] = "’ˆÓ: ²ÝÎß°Ä‚³‚ꂽ EPS ¸Þ×̨¯¸‚Ì’†‚Ì‚¢‚‚‚©‚Í\n‚‚¢ÚÍÞÙ‚É‚ ‚é‚Ì‚ÅÚÍÞÙ1‚É•Û‘¶‚Å‚«‚Ü‚¹‚ñ!";
+ Text[ greek ] = "Ðñïóï÷Þ: Äåí Þôáí äõíáôüí íá ãßíåé áðïèÞêåõóç üëùí ôùí åéóçãìÝíùí ãñáöéêþí EPS,\nåðåéäÞ ìåñéêÜ áðü áõôÜ õðÜñ÷ïõí óå ìïñöÞ õøçëüôåñïõ åðéðÝäïõ!";
+ Text[ korean ] = "ÁÖÀÇ: »óÀ§ ·¹º§¿¡ ±×·¡ÇÈÀÌ ¸î °¡Áö Àֱ⠶§¹®¿¡\n°¡Á®¿Â EPS ±×·¡ÇÈÀ» ·¹º§1¿¡ ¸ðµÎ ÀúÀåÇÏÁö´Â ¸øÇß½À´Ï´Ù.";
+ Text[ chinese_traditional ] = "ª`·N¡GµLªk±N©Ò¦³ªº¿é¤J¹Ï§Î¥H¡§level 1¡¨Àx¦s¡M\n¦]¬°¤@¨Ç¹Ï§Î¬O°ª©ó¡§level 1¡¨ ¡I";
+ Text[ arabic ] = "ÊÍÐíÑ: ÊÚÐÑ ÍÝÙ ßá ÕæÑ EPS ÇáãÓÊæÑÏÉ Ýí ÇáãÓÊæì 1¡\náÊæÇÌÏ ÈÚÖ ãäåÇ Ýí ãÓÊæì ÃÚáì!";
+ Text[ turkish ] = "Dikkat: Bazý EPS grafikleri daha üst düzeyde olduðu için, içe aktarýlan tüm grafikler düzey 1'e kaydedilemedi.";
+ Text[ language_user1 ] = " ";
+};
diff --git a/goodies/source/filter.vcl/eps/makefile.mk b/goodies/source/filter.vcl/eps/makefile.mk
new file mode 100644
index 000000000000..efdd66bf05bc
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/makefile.mk
@@ -0,0 +1,181 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=eps
+DEPTARGET=veps
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+GEN_HID=TRUE
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SRCFILES = dlgeps.src \
+ epsstr.src
+
+SLOFILES = $(SLO)$/eps.obj \
+ $(SLO)$/dlgeps.obj
+
+# ==========================================================================
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES=\
+ $(SRS)$/$(TARGET).srs
+
+SHL1TARGET= eps$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= eps
+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(SVLIB) $(SVTOOLLIB) $(CPPULIB)
+SHL1DEPN= $(LB)$/eps.lib
+SHL1LIBS= $(SLB)$/eps.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/eps.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+ @echo _DoExportDialog >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET) >>$@
+ @echo GraphicExport_ >>temp.def
+ @echo DoExportDialog_ >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+ @echo DoExportDialog >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/eps/strings.hrc b/goodies/source/filter.vcl/eps/strings.hrc
new file mode 100644
index 000000000000..5b6f111d5dc5
--- /dev/null
+++ b/goodies/source/filter.vcl/eps/strings.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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 KEY_COMPR 256
+#define KEY_VERSION 257
+#define KEY_COLOR 258
+#define KEY_PREVIEW 259
+#define KEY_VERSION_CHECK 260
+
diff --git a/goodies/source/filter.vcl/eras/eras.cxx b/goodies/source/filter.vcl/eras/eras.cxx
new file mode 100644
index 000000000000..4b5ff0867c5c
--- /dev/null
+++ b/goodies/source/filter.vcl/eras/eras.cxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * $RCSfile: eras.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+
+//============================ RASWriter ==================================
+
+class RASWriter {
+
+private:
+
+ PFilterCallback mpCallback;
+ void * mpCallerData;
+
+ SvStream* mpOStm;
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ BitmapReadAccess* mpAcc;
+
+ ULONG mnWidth, mnHeight;
+ USHORT mnColors, mnDepth;
+
+ ULONG mnRepCount;
+ BYTE mnRepVal;
+
+ BOOL ImplCallback( ULONG nCurrentYPos );
+ BOOL ImplWriteHeader();
+ void ImplWritePalette();
+ void ImplWriteBody();
+ void ImplPutByte( BYTE ); // RLE decoding
+
+public:
+ RASWriter();
+ ~RASWriter();
+
+ BOOL WriteRAS( const Graphic& rGraphic, SvStream& rRAS,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig );
+};
+
+//=================== Methoden von RASWriter ==============================
+
+RASWriter::RASWriter() :
+ mpAcc ( NULL ),
+ mbStatus ( TRUE ),
+ mnRepCount ( 0xffffffff )
+{
+}
+
+// ------------------------------------------------------------------------
+
+RASWriter::~RASWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL RASWriter::ImplCallback( ULONG nYPos )
+{
+ if ( mpCallback != NULL )
+ {
+ if ( ( (*mpCallback)( mpCallerData, (USHORT)( ( 100 * nYPos ) / mnHeight ) ) ) == TRUE )
+ {
+ mpOStm->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL RASWriter::WriteRAS( const Graphic& rGraphic, SvStream& rRAS,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig )
+{
+ Bitmap aBmp;
+
+ mpOStm = &rRAS;
+ mpCallback = pCallback;
+ mpCallerData = pCallerdata;
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ aBmp = aBmpEx.GetBitmap();
+
+ if ( aBmp.GetBitCount() == 4 )
+ aBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+
+ mnDepth = aBmp.GetBitCount();
+
+ if ( ( mpAcc = aBmp.AcquireReadAccess() ) )
+ {
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ if ( ImplWriteHeader() )
+ {
+ if ( mnDepth <= 8 )
+ ImplWritePalette();
+ ImplWriteBody();
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL RASWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnDepth <= 8 )
+ {
+ if (!( mnColors = mpAcc->GetPaletteEntryCount() ) )
+ mbStatus = FALSE;
+ }
+ if ( mbStatus && mnWidth && mnHeight && mnDepth )
+ {
+ *mpOStm << (UINT32)0x59a66a95 << (UINT32)mnWidth << (UINT32)mnHeight
+ << (UINT32)mnDepth
+ << (UINT32) ( ( ( ( mnWidth * mnDepth ) + 15 ) >> 4 ) << 1 ) * mnHeight
+ << (UINT32)2;
+
+ if ( mnDepth > 8 )
+ *mpOStm << (UINT32)0 << (UINT32)0;
+ else
+ {
+
+ *mpOStm << (UINT32)1 << (UINT32)( mnColors * 3 );
+ }
+ }
+ else mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void RASWriter::ImplWritePalette()
+{
+ USHORT i;
+
+ for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetRed() );
+ for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetGreen() );
+ for ( i = 0; i < mnColors; *mpOStm << mpAcc->GetPaletteColor( i++ ).GetBlue() );
+}
+
+// ------------------------------------------------------------------------
+
+void RASWriter::ImplWriteBody()
+{
+ ULONG x, y;
+
+ if ( mnDepth == 24 )
+ {
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( y ); // processing output
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ BitmapColor aColor( mpAcc->GetPixel( y, x ) );
+ ImplPutByte( aColor.GetBlue() ); // Format ist BGR
+ ImplPutByte( aColor.GetGreen() );
+ ImplPutByte( aColor.GetRed() );
+ }
+ if ( x & 1 ) ImplPutByte( 0 ); // WORD ALIGNMENT ???
+ }
+ }
+ else if ( mnDepth == 8 )
+ {
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( y ); // processing output
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ ImplPutByte ( mpAcc->GetPixel( y, x ) );
+ }
+ if ( x & 1 ) ImplPutByte( 0 ); // WORD ALIGNMENT ???
+ }
+ }
+ else if ( mnDepth == 1 )
+ {
+ BYTE nDat;
+
+ for ( y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( y ); // processing output
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ nDat = ( ( nDat << 1 ) | ( mpAcc->GetPixel ( y, x ) & 1 ) );
+ if ( ( x & 7 ) == 7 )
+ ImplPutByte( nDat );
+ }
+ if ( x & 7 )
+ ImplPutByte( nDat << ( ( ( x & 7 ) ^ 7 ) + 1) );// write remaining bits
+ if (!( ( x - 1 ) & 0x8 ) )
+ ImplPutByte( 0 ); // WORD ALIGNMENT ???
+ }
+ }
+ ImplPutByte( mnRepVal + 1 ); // end of RLE decoding
+}
+
+// ------------------------------------------------------------------------
+
+void RASWriter::ImplPutByte( BYTE nPutThis )
+{
+ if ( mnRepCount == 0xffffffff )
+ {
+ mnRepCount = 0;
+ mnRepVal = nPutThis;
+ }
+ else
+ {
+ if ( ( nPutThis == mnRepVal ) && ( mnRepCount != 0xff ) )
+ mnRepCount++;
+ else
+ {
+ if ( mnRepCount == 0 )
+ {
+ *mpOStm << (BYTE)mnRepVal;
+ if ( mnRepVal == 0x80 )
+ *mpOStm << (BYTE)0;
+ }
+ else
+ {
+ *mpOStm << (BYTE)0x80;
+ *mpOStm << (BYTE)mnRepCount;
+ *mpOStm << (BYTE)mnRepVal;
+ }
+ mnRepVal = nPutThis;
+ mnRepCount = 0;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig, BOOL )
+{
+ RASWriter aRASWriter;
+
+ return aRASWriter.WriteRAS( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+#pragma hdrstop
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/eras/makefile.mk b/goodies/source/filter.vcl/eras/makefile.mk
new file mode 100644
index 000000000000..8042437f5f67
--- /dev/null
+++ b/goodies/source/filter.vcl/eras/makefile.mk
@@ -0,0 +1,169 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=eras
+DEPTARGET=veras
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SLOFILES = $(SLO)$/eras.obj
+
+# ==========================================================================
+
+SHL1TARGET= era$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= eras
+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB)
+SHL1DEPN= $(LB)$/eras.lib
+SHL1LIBS= $(SLB)$/eras.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/eras.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).DLL >>$@
+ @ldump -E1 -A $(SLB)$/eras.lib >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/etiff/etiff.cxx b/goodies/source/filter.vcl/etiff/etiff.cxx
new file mode 100644
index 000000000000..3ed0ec8f272b
--- /dev/null
+++ b/goodies/source/filter.vcl/etiff/etiff.cxx
@@ -0,0 +1,663 @@
+/*************************************************************************
+ *
+ * $RCSfile: etiff.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define NewSubfileType 254
+#define ImageWidth 256
+#define ImageLength 257
+#define BitsPerSample 258
+#define Compression 259
+#define PhotometricInterpretation 262
+#define StripOffsets 273
+#define SamplesPerPixel 277
+#define RowsPerStrip 278
+#define StripByteCounts 279
+#define XResolution 282
+#define YResolution 283
+#define PlanarConfiguration 284
+#define ResolutionUnit 296
+#define ColorMap 320
+#define ReferenceBlackWhite 532
+
+// -------------
+// - TIFFWriter -
+// -------------
+
+struct TIFFLZWCTreeNode
+{
+
+ TIFFLZWCTreeNode* pBrother; // naechster Knoten, der den selben Vater hat
+ TIFFLZWCTreeNode* pFirstChild; // erster Sohn
+ USHORT nCode; // Der Code fuer den String von Pixelwerten, der sich ergibt, wenn
+ USHORT nValue; // Der Pixelwert
+};
+
+class TIFFWriter
+{
+private:
+
+ PFilterCallback mpCallback;
+ void* mpCallerData;
+ SvStream* mpOStm;
+ UINT32 mnStreamOfs;
+
+ BOOL mbStatus;
+ BitmapReadAccess* mpAcc;
+
+ UINT32 mnWidth, mnHeight, mnColors;
+ UINT32 mnCurAllPictHeight;
+ UINT32 mnSumOfAllPictHeight;
+ UINT32 mnBitsPerPixel;
+ UINT32 mnLastPercent;
+
+ UINT32 mnLatestIfdPos;
+ UINT16 mnTagCount; // number of tags already written
+ UINT32 mnCurrentTagCountPos; // offset to the position where the current
+ // tag count is to insert
+
+ UINT32 mnXResPos; // if != 0 this DWORDs stores the
+ UINT32 mnYResPos; // actual streamposition of the
+ UINT32 mnPalPos; // Tag Entry
+ UINT32 mnBitmapPos;
+ UINT32 mnStripByteCountPos;
+
+ TIFFLZWCTreeNode* pTable;
+ TIFFLZWCTreeNode* pPrefix;
+ USHORT nDataSize;
+ USHORT nClearCode;
+ USHORT nEOICode;
+ USHORT nTableSize;
+ USHORT nCodeSize;
+ ULONG nOffset;
+ ULONG dwShift;
+
+ void ImplCallback( UINT32 nPercent );
+ BOOL ImplWriteHeader( BOOL bMultiPage );
+ void ImplWritePalette();
+ BOOL ImplWriteBody();
+ void ImplWriteTag( UINT16 TagID, UINT16 DataType, UINT32 NumberOfItems, UINT32 Value);
+ void ImplWriteResolution( ULONG nStreamPos, ULONG nResolutionUnit );
+ void StartCompression();
+ void Compress( BYTE nSrc );
+ void EndCompression();
+ inline void WriteBits( USHORT nCode, USHORT nCodeLen );
+
+public:
+
+ TIFFWriter();
+ ~TIFFWriter();
+
+ BOOL WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig );
+};
+
+// ------------------------------------------------------------------------
+
+TIFFWriter::TIFFWriter() :
+ mnLastPercent ( 0 ),
+ mnXResPos ( 0 ),
+ mnYResPos ( 0 ),
+ mnCurAllPictHeight ( 0 ),
+ mnSumOfAllPictHeight( 0 ),
+ mnStripByteCountPos ( 0 ),
+ mnBitmapPos ( 0 ),
+ mpAcc ( NULL ),
+ mbStatus ( TRUE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+TIFFWriter::~TIFFWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL TIFFWriter::WriteTIFF( const Graphic& rGraphic, SvStream& rTIFF,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig )
+{
+ ULONG* pDummy = new ULONG; delete pDummy; // damit unter OS/2
+ // das richtige (Tools-)new
+ // verwendet wird, da es sonst
+ // in dieser DLL nur Vector-news
+ // gibt;
+
+ mpOStm = &rTIFF;
+ mpCallback = pCallback;
+ mpCallerData = pCallerdata;
+
+ const UINT16 nOldFormat = mpOStm->GetNumberFormatInt();
+ mnStreamOfs = mpOStm->Tell();
+
+ // we will use the BIG Endian Mode
+ // TIFF header
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ *mpOStm << (UINT32)0x4d4d002a; // TIFF identifier
+ mnLatestIfdPos = mpOStm->Tell();
+ *mpOStm << (UINT32)0;
+
+ Animation aAnimation;
+ Bitmap aBmp;
+
+ if( mbStatus )
+ {
+ if ( rGraphic.IsAnimated() )
+ aAnimation = rGraphic.GetAnimation();
+ else
+ {
+ AnimationBitmap aAnimationBitmap( rGraphic.GetBitmap(), Point(), Size() );
+ aAnimation.Insert( aAnimationBitmap );
+ }
+
+ USHORT i;
+ for ( i = 0; i < aAnimation.Count(); i++ )
+ mnSumOfAllPictHeight += aAnimation.Get( i ).aBmpEx.GetSizePixel().Height();
+
+ for ( i = 0; mbStatus && ( i < aAnimation.Count() ); i++ )
+ {
+ mnPalPos = 0;
+ const AnimationBitmap& rAnimationBitmap = aAnimation.Get( i );
+ aBmp = rAnimationBitmap.aBmpEx.GetBitmap();
+ mpAcc = aBmp.AcquireReadAccess();
+ if ( mpAcc )
+ {
+ mnBitsPerPixel = aBmp.GetBitCount();
+ if ( ImplWriteHeader( ( aAnimation.Count() > 0 ) ) )
+ {
+ Size aDestMapSize( 300, 300 );
+ const MapMode aMapMode( aBmp.GetPrefMapMode() );
+ if ( aMapMode.GetMapUnit() != MAP_PIXEL )
+ {
+ const Size aPrefSize( rGraphic.GetPrefSize() );
+ aDestMapSize = OutputDevice::LogicToLogic( aPrefSize, aMapMode, MAP_INCH );
+ }
+ ImplWriteResolution( mnXResPos, aDestMapSize.Width() );
+ ImplWriteResolution( mnYResPos, aDestMapSize.Height() );
+ if ( mnPalPos )
+ ImplWritePalette();
+ ImplWriteBody();
+ }
+ UINT32 nCurPos = mpOStm->Tell();
+ mpOStm->Seek( mnCurrentTagCountPos );
+ *mpOStm << mnTagCount;
+ mpOStm->Seek( nCurPos );
+
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+ }
+ }
+ mpOStm->SetNumberFormatInt( nOldFormat );
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplCallback( UINT32 nPercent )
+{
+ if( nPercent >= mnLastPercent + 3 )
+ {
+ mnLastPercent = nPercent;
+
+ if( mpCallback && ( nPercent <= 100 ) && mbStatus )
+ if ( ( (*mpCallback)( mpCallerData, (UINT16) nPercent ) ) )
+ mbStatus = FALSE;
+ }
+}
+
+
+// ------------------------------------------------------------------------
+
+BOOL TIFFWriter::ImplWriteHeader( BOOL bMultiPage )
+{
+ mnTagCount = 0;
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+
+ if ( mnWidth && mnHeight && mnBitsPerPixel && mbStatus )
+ {
+ UINT32 nCurrentPos = mpOStm->Tell();
+ mpOStm->Seek( mnLatestIfdPos );
+ *mpOStm << (UINT32)( nCurrentPos - mnStreamOfs ); // offset to the IFD
+ mpOStm->Seek( nCurrentPos );
+
+ // (OFS8) TIFF image file directory (IFD)
+ mnCurrentTagCountPos = mpOStm->Tell();
+ *mpOStm << (UINT16)0; // the number of tagentrys is to insert later
+
+ UINT32 nSubFileFlags = 0;
+ if ( bMultiPage )
+ nSubFileFlags |= 2;
+ ImplWriteTag( NewSubfileType, 4, 1, nSubFileFlags );
+ ImplWriteTag( ImageWidth, 4, 1, mnWidth );
+ ImplWriteTag( ImageLength, 4, 1, mnHeight);
+ ImplWriteTag( BitsPerSample, 3, 1, ( mnBitsPerPixel == 24 ) ? 8 : mnBitsPerPixel );
+ ImplWriteTag( Compression, 3, 1, 5 );
+ BYTE nTemp;
+ switch ( mnBitsPerPixel )
+ {
+ case 1 :
+ nTemp = 1;
+ break;
+ case 4 :
+ case 8 :
+ nTemp = 3;
+ break;
+ case 24:
+ nTemp = 2;
+ break;
+ }
+ ImplWriteTag( PhotometricInterpretation, 3, 1, nTemp );
+ mnBitmapPos = mpOStm->Tell();
+ ImplWriteTag( StripOffsets, 4, 1, 0 );
+ ImplWriteTag( SamplesPerPixel, 3, 1, ( mnBitsPerPixel == 24 ) ? 3 : 1 );
+ ImplWriteTag( RowsPerStrip, 4, 1, mnHeight ); //0xffffffff );
+ mnStripByteCountPos = mpOStm->Tell();
+ ImplWriteTag( StripByteCounts, 4, 1, ( ( mnWidth * mnBitsPerPixel * mnHeight ) + 7 ) >> 3 );
+ mnXResPos = mpOStm->Tell();
+ ImplWriteTag( XResolution, 5, 1, 0 );
+ mnYResPos = mpOStm->Tell();
+ ImplWriteTag( YResolution, 5, 1, 0 );
+ if ( mnBitsPerPixel != 1 )
+ ImplWriteTag( PlanarConfiguration, 3, 1, 1 ); // ( RGB ORDER )
+ ImplWriteTag( ResolutionUnit, 3, 1, 2); // Resolution Unit is Inch
+ if ( ( mnBitsPerPixel == 4 ) || ( mnBitsPerPixel == 8 ) )
+ {
+ mnColors = mpAcc->GetPaletteEntryCount();
+ mnPalPos = mpOStm->Tell();
+ ImplWriteTag( ColorMap, 3, 3 * mnColors, 0 );
+ }
+
+ // and last we write zero to close the num dir entries list
+ mnLatestIfdPos = mpOStm->Tell();
+ *mpOStm << (UINT32)0; // there are no more IFD
+ }
+ else
+ mbStatus = FALSE;
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplWritePalette()
+{
+ USHORT i;
+ ULONG nCurrentPos = mpOStm->Tell();
+ mpOStm->Seek( mnPalPos + 8 ); // the palette tag entry needs the offset
+ *mpOStm << nCurrentPos - mnStreamOfs; // to the palette colors
+ mpOStm->Seek( nCurrentPos );
+
+ for ( i = 0; i < mnColors; i++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
+ *mpOStm << (UINT16)( rColor.GetRed() << 8 );
+ }
+ for ( i = 0; i < mnColors; i++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
+ *mpOStm << (UINT16)( rColor.GetGreen() << 8 );
+ }
+ for ( i = 0; i < mnColors; i++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( i );
+ *mpOStm << (UINT16)( rColor.GetBlue() << 8 );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL TIFFWriter::ImplWriteBody()
+{
+ BYTE nTemp, nShift;
+ ULONG j, x, y;
+
+ ULONG nGfxBegin = mpOStm->Tell();
+ mpOStm->Seek( mnBitmapPos + 8 ); // the strip offset tag entry needs the offset
+ *mpOStm << nGfxBegin - mnStreamOfs; // to the bitmap data
+ mpOStm->Seek( nGfxBegin );
+
+ StartCompression();
+
+ switch( mnBitsPerPixel )
+ {
+ case 24 :
+ {
+ for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ const BitmapColor& rColor = mpAcc->GetPixel( y, x );
+ Compress( rColor.GetRed() );
+ Compress( rColor.GetGreen() );
+ Compress( rColor.GetBlue() );
+ }
+ }
+ }
+ break;
+
+ case 8 :
+ {
+ for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++ )
+ {
+ Compress( mpAcc->GetPixel( y, x ) );
+ }
+ }
+ }
+ break;
+
+ case 4 :
+ {
+ for ( nShift = 0, y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++, nShift++ )
+ {
+ if (!( nShift & 1 ))
+ nTemp = ( (BYTE)mpAcc->GetPixel( y, x ) << 4 );
+ else
+ Compress( (BYTE)( nTemp | ( mpAcc->GetPixel( y, x ) & 0xf ) ) );
+ }
+ if ( nShift & 1 )
+ Compress( nTemp );
+ }
+ }
+ break;
+
+ case 1 :
+ {
+ j = 1;
+ for ( y = 0; y < mnHeight; y++, mnCurAllPictHeight++ )
+ {
+ ImplCallback( 100 * mnCurAllPictHeight / mnSumOfAllPictHeight );
+ for ( x = 0; x < mnWidth; x++)
+ {
+ j <<= 1;
+ j |= ( ( ~mpAcc->GetPixel( y, x ) ) & 1 );
+ if ( j & 0x100 )
+ {
+ Compress( (BYTE)j );
+ j = 1;
+ }
+ }
+ if ( j != 1 )
+ {
+ Compress( (BYTE)(j << ( ( ( x & 7) ^ 7 ) + 1 ) ) );
+ j = 1;
+ }
+ }
+ }
+ break;
+
+ default:
+ {
+ mbStatus = FALSE;
+ }
+ break;
+ }
+
+ EndCompression();
+
+ if ( mnStripByteCountPos && mbStatus )
+ {
+ ULONG nGfxEnd = mpOStm->Tell();
+ mpOStm->Seek( mnStripByteCountPos + 8 );
+ *mpOStm << ( nGfxEnd - nGfxBegin ); // mnStripByteCountPos needs the size of the compression data
+ mpOStm->Seek( nGfxEnd );
+ }
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplWriteResolution( ULONG nStreamPos, ULONG nResolutionUnit )
+{
+ ULONG nCurrentPos = mpOStm->Tell();
+ mpOStm->Seek( nStreamPos + 8 );
+ *mpOStm << (UINT32)nCurrentPos - mnStreamOfs;
+ mpOStm->Seek( nCurrentPos );
+ *mpOStm << (ULONG)1;
+ *mpOStm << nResolutionUnit;
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::ImplWriteTag( UINT16 nTagID, UINT16 nDataType, UINT32 nNumberOfItems, UINT32 nValue)
+{
+ mnTagCount++;
+
+ *mpOStm << nTagID;
+ *mpOStm << nDataType;
+ *mpOStm << nNumberOfItems;
+ if ( nDataType == 3 )
+ nValue <<=16; // in Big Endian Mode WORDS needed to be shifted to a DWORD
+ *mpOStm << nValue;
+}
+
+// ------------------------------------------------------------------------
+
+inline void TIFFWriter::WriteBits( USHORT nCode, USHORT nCodeLen )
+{
+ dwShift |= ( nCode << ( nOffset - nCodeLen ) );
+ nOffset -= nCodeLen;
+ while ( nOffset < 24 )
+ {
+ *mpOStm << (BYTE)( dwShift >> 24 );
+ dwShift <<= 8;
+ nOffset += 8;
+ }
+ if ( nCode == 257 && nOffset != 32 )
+ {
+ *mpOStm << (BYTE)( dwShift >> 24 );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::StartCompression()
+{
+ USHORT i;
+ nDataSize = 8;
+
+ nClearCode = 1 << nDataSize;
+ nEOICode = nClearCode + 1;
+ nTableSize = nEOICode + 1;
+ nCodeSize = nDataSize + 1;
+
+ nOffset = 32; // anzahl freier bits in dwShift
+ dwShift = 0;
+
+ pTable = new TIFFLZWCTreeNode[ 4096 ];
+
+ for ( i = 0; i < 4096; i++)
+ {
+ pTable[ i ].pBrother = pTable[ i ].pFirstChild = NULL;
+ pTable[ i ].nValue = (BYTE)( pTable[ i ].nCode = i );
+ }
+
+ pPrefix = NULL;
+ WriteBits( nClearCode, nCodeSize );
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::Compress( BYTE nCompThis )
+{
+ TIFFLZWCTreeNode* p;
+ USHORT i;
+ BYTE nV;
+
+ if( !pPrefix )
+ {
+ pPrefix = pTable + nCompThis;
+ }
+ else
+ {
+ nV = nCompThis;
+ for( p = pPrefix->pFirstChild; p != NULL; p = p->pBrother )
+ {
+ if ( p->nValue == nV )
+ break;
+ }
+
+ if( p )
+ pPrefix = p;
+ else
+ {
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ if ( nTableSize == 409 )
+ {
+ WriteBits( nClearCode, nCodeSize );
+
+ for ( i = 0; i < nClearCode; i++ )
+ pTable[ i ].pFirstChild = NULL;
+
+ nCodeSize = nDataSize + 1;
+ nTableSize = nEOICode + 1;
+ }
+ else
+ {
+ if( nTableSize == (USHORT)( ( 1 << nCodeSize ) - 1 ) )
+ nCodeSize++;
+
+ p = pTable + ( nTableSize++ );
+ p->pBrother = pPrefix->pFirstChild;
+ pPrefix->pFirstChild = p;
+ p->nValue = nV;
+ p->pFirstChild = NULL;
+ }
+
+ pPrefix = pTable + nV;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void TIFFWriter::EndCompression()
+{
+ if( pPrefix )
+ WriteBits( pPrefix->nCode, nCodeSize );
+
+ WriteBits( nEOICode, nCodeSize );
+ delete[] pTable;
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig, BOOL )
+{
+ return TIFFWriter().WriteTIFF( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+
+#pragma hdrstop
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
+
diff --git a/goodies/source/filter.vcl/etiff/makefile.mk b/goodies/source/filter.vcl/etiff/makefile.mk
new file mode 100644
index 000000000000..2ecca7af87bc
--- /dev/null
+++ b/goodies/source/filter.vcl/etiff/makefile.mk
@@ -0,0 +1,169 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=etiff
+DEPTARGET=vetiff
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SLOFILES = $(SLO)$/etiff.obj
+
+# ==========================================================================
+
+SHL1TARGET= eti$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= etiff
+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB)
+SHL1DEPN= $(LB)$/etiff.lib
+SHL1LIBS= $(SLB)$/etiff.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/etiff.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET) >>$@
+ @echo GraphicExport_ >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/expm/expm.cxx b/goodies/source/filter.vcl/expm/expm.cxx
new file mode 100644
index 000000000000..a989f5d1d0d5
--- /dev/null
+++ b/goodies/source/filter.vcl/expm/expm.cxx
@@ -0,0 +1,331 @@
+/*************************************************************************
+ *
+ * $RCSfile: expm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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
+#include
+#include
+
+//============================ XPMWriter ==================================
+
+class XPMWriter {
+
+private:
+
+ PFilterCallback mpCallback;
+ void * mpCallerData;
+
+ SvStream* mpOStm; // Die auszugebende XPM-Datei
+ USHORT mpOStmOldModus;
+
+ BOOL mbStatus;
+ BOOL mbTrans;
+ BitmapReadAccess* mpAcc;
+ ULONG mnWidth, mnHeight; // Bildausmass in Pixeln
+ USHORT mnColors;
+
+ BOOL ImplCallback( USHORT nPercent );
+ BOOL ImplWriteHeader();
+ void ImplWritePalette();
+ void ImplWriteColor( USHORT );
+ void ImplWriteBody();
+ void ImplWriteNumber( sal_Int32 );
+ void ImplWritePixel( ULONG );
+
+public:
+ XPMWriter();
+ ~XPMWriter();
+
+ BOOL WriteXPM( const Graphic& rGraphic, SvStream& rXPM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig );
+};
+
+//=================== Methoden von XPMWriter ==============================
+
+XPMWriter::XPMWriter() :
+ mpAcc ( NULL ),
+ mbStatus ( TRUE ),
+ mbTrans ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+XPMWriter::~XPMWriter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL XPMWriter::ImplCallback( USHORT nPercent )
+{
+ if ( mpCallback != NULL )
+ {
+ if ( ( (*mpCallback)( mpCallerData, nPercent ) ) == TRUE )
+ {
+ mpOStm->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL XPMWriter::WriteXPM( const Graphic& rGraphic, SvStream& rXPM,
+ PFilterCallback pCallback, void* pCallerdata,
+ Config* pOptionsConfig )
+{
+ Bitmap aBmp;
+
+ mpOStm = &rXPM;
+ mpCallback = pCallback;
+ mpCallerData = pCallerdata;
+
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+ aBmp = aBmpEx.GetBitmap();
+
+ if ( rGraphic.IsTransparent() ) // event. transparente Farbe erzeugen
+ {
+ mbTrans = TRUE;
+ if ( aBmp.GetBitCount() >= 8 ) // wenn noetig Bild auf 8 bit konvertieren
+ aBmp.Convert( BMP_CONVERSION_8BIT_TRANS );
+ else
+ aBmp.Convert( BMP_CONVERSION_4BIT_TRANS );
+ aBmp.Replace( aBmpEx.GetMask(), BMP_COL_TRANS );
+ }
+ else
+ {
+ if ( aBmp.GetBitCount() > 8 ) // wenn noetig Bild auf 8 bit konvertieren
+ aBmp.Convert( BMP_CONVERSION_8BIT_COLORS );
+ }
+ if ( ( mpAcc = aBmp.AcquireReadAccess() ) )
+ {
+ mnColors = mpAcc->GetPaletteEntryCount();
+ mpOStmOldModus = mpOStm->GetNumberFormatInt();
+ mpOStm->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+
+ if ( ImplWriteHeader() )
+ {
+ ImplWritePalette();
+ ImplWriteBody();
+ *mpOStm << "\x22XPMENDEXT\x22\x0a};";
+ }
+ aBmp.ReleaseAccess( mpAcc );
+ }
+ else
+ mbStatus = FALSE;
+
+ mpOStm->SetNumberFormatInt( mpOStmOldModus );
+
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL XPMWriter::ImplWriteHeader()
+{
+ mnWidth = mpAcc->Width();
+ mnHeight = mpAcc->Height();
+ if ( mnWidth && mnHeight && mnColors )
+ {
+ *mpOStm << "/* XPM */\x0astatic char * image[] = \x0a{\x0a\x22";
+ ImplWriteNumber( mnWidth );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnHeight );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( mnColors );
+ *mpOStm << (BYTE)32;
+ ImplWriteNumber( ( mnColors > 26 ) ? 2 : 1 );
+ *mpOStm << "\x22,\x0a";
+ }
+ else mbStatus = FALSE;
+ return mbStatus;
+}
+
+// ------------------------------------------------------------------------
+
+void XPMWriter::ImplWritePalette()
+{
+ USHORT nTransIndex = 0xffff;
+
+ if ( mbTrans )
+ nTransIndex = mpAcc->GetBestMatchingColor( BMP_COL_TRANS );
+ for ( USHORT i = 0; i < mnColors; i++ )
+ {
+ *mpOStm << "\x22";
+ ImplWritePixel( i );
+ *mpOStm << (BYTE)32;
+ if ( nTransIndex != i )
+ {
+ ImplWriteColor( i );
+ *mpOStm << "\x22,\x0a";
+ }
+ else
+ *mpOStm << "c none\x22,\x0a";
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void XPMWriter::ImplWriteBody()
+{
+ for ( ULONG y = 0; y < mnHeight; y++ )
+ {
+ ImplCallback( (USHORT)( ( 100 * y ) / mnHeight ) ); // processing output in percent
+ *mpOStm << (BYTE)0x22;
+ for ( ULONG x = 0; x < mnWidth; x++ )
+ {
+ ImplWritePixel( (BYTE)(mpAcc->GetPixel( y, x ) ) );
+ }
+ *mpOStm << "\x22,\x0a";
+ }
+}
+
+// ------------------------------------------------------------------------
+// eine Dezimalzahl im ASCII format wird in den Stream geschrieben
+
+void XPMWriter::ImplWriteNumber( sal_Int32 nNumber )
+{
+ const ByteString aNum( ByteString::CreateFromInt32( nNumber ) );
+
+ for( sal_Int32 n = 0UL, nLen = aNum.Len(); n < nLen; n++ )
+ *mpOStm << aNum.GetChar( n );
+
+}
+
+// ------------------------------------------------------------------------
+
+void XPMWriter::ImplWritePixel( ULONG nCol )
+{
+ if ( mnColors > 26 )
+ {
+ BYTE nDiff = (BYTE) ( nCol / 26 );
+ *mpOStm << (BYTE)( nDiff + 'A' );
+ *mpOStm << (BYTE)( nCol - ( nDiff*26 ) + 'A' );
+ }
+ else
+ *mpOStm << (BYTE)( nCol + 'A' );
+}
+
+// ------------------------------------------------------------------------
+// ein Farbwert wird im Hexadezimalzahlformat in den Stream geschrieben
+void XPMWriter::ImplWriteColor( USHORT nNumber )
+{
+ ULONG nTmp;
+ BYTE j;
+
+ *mpOStm << "c #"; // # zeigt einen folgenden Hexwert an
+ const BitmapColor& rColor = mpAcc->GetPaletteColor( nNumber );
+ nTmp = ( rColor.GetRed() << 16 ) | ( rColor.GetGreen() << 8 ) | rColor.GetBlue();
+ for ( char i = 20; i >= 0 ; i-=4 )
+ {
+ if ( ( j = (BYTE)( nTmp >> i ) & 0xf ) > 9 )
+ j += 'A' - 10;
+ else
+ j += '0';
+ *mpOStm << j;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+// ---------------------
+// - exported function -
+// ---------------------
+
+extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig, BOOL )
+{
+ XPMWriter aXPMWriter;
+
+ return aXPMWriter.WriteXPM( rGraphic, rStream, pCallback, pCallerData, pOptionsConfig );
+}
+
+#pragma hdrstop
+
+// ---------------
+// - Win16 trash -
+// ---------------
+
+#ifdef WIN
+
+static HINSTANCE hDLLInst = 0;
+
+extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ hDLLInst = hDLL;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+#endif
diff --git a/goodies/source/filter.vcl/expm/makefile.mk b/goodies/source/filter.vcl/expm/makefile.mk
new file mode 100644
index 000000000000..6f25cd3299ca
--- /dev/null
+++ b/goodies/source/filter.vcl/expm/makefile.mk
@@ -0,0 +1,169 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30: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=goodies
+TARGET=expm
+DEPTARGET=vexpm
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=eeng_pch
+PROJECTPCHSOURCE=eeng_pch
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(editdebug)"!="" || "$(EDITDEBUG)"!=""
+CDEFS+= -DEDITDEBUG
+.ENDIF
+
+SLOFILES = $(SLO)$/expm.obj
+
+# ==========================================================================
+
+SHL1TARGET= exp$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= expm
+SHL1STDLIBS= $(TOOLSLIB) $(SVLIB) $(CPPULIB)
+SHL1DEPN= $(LB)$/expm.lib
+SHL1LIBS= $(SLB)$/expm.lib
+
+.IF "$(GUI)" != "UNX"
+SHL1OBJS= $(SLO)$/expm.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1BASE=0x1c000000
+
+.IF "$(depend)" == ""
+
+all: ALLTAR
+
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(SHL1TARGET).def:\
+ makefile.mk \
+ $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(DLLNAME) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'StarView Filter DLL' >>$@
+.IF "$(COM)" == "ZTC"
+ @echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"=="ICC"
+ @echo GraphicExport >>$@
+.ELSE
+ @echo _GraphicExport >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView Filter DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).DLL >>$@
+ @ldump -E1 -A $(SLB)$/expm.lib >>temp.def
+ @gawk -f s:\util\exp.awk temp.def >>$@
+ @del temp.def
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk $(MISC)$/$(SHL1TARGET).flt
+ @echo -------------------------------------------
+ @echo DEF-File erstellen
+ @echo LIBRARY $(DLLNAME) >$@
+ @echo DESCRIPTION 'Svx RTF DLL' >>$@
+ @echo DATA READ WRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GraphicExport >>$@
+
+.ENDIF
+
+$(MISC)$/$(SHL1TARGET).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+.ELSE
+dummy:
+ @+echo No VCL - do nothing!
+.ENDIF #VCL
diff --git a/goodies/source/filter.vcl/icgm/actimpr.cxx b/goodies/source/filter.vcl/icgm/actimpr.cxx
new file mode 100644
index 000000000000..d861b52114c9
--- /dev/null
+++ b/goodies/source/filter.vcl/icgm/actimpr.cxx
@@ -0,0 +1,1324 @@
+/*************************************************************************
+ *
+ * $RCSfile: actimpr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30: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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_BITMAPEX_HXX
+#include
+#endif
+
+#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGESSUPPLIER_HPP_
+#include