From 84a3db80b4fd66c6854b3135b5f69b61fd828e62 Mon Sep 17 00:00:00 2001
From: Jens-Heiner Rechtien
Date: Mon, 18 Sep 2000 23:08:29 +0000
Subject: initial import
---
sw/source/core/attr/calbck.cxx | 642 ++++
sw/source/core/attr/cellatr.cxx | 318 ++
sw/source/core/attr/format.cxx | 677 ++++
sw/source/core/attr/hints.cxx | 299 ++
sw/source/core/attr/makefile.mk | 101 +
sw/source/core/attr/swatrset.cxx | 380 +++
sw/source/core/bastyp/bparr.cxx | 634 ++++
sw/source/core/bastyp/breakit.cxx | 109 +
sw/source/core/bastyp/calc.cxx | 1841 +++++++++++
sw/source/core/bastyp/index.cxx | 772 +++++
sw/source/core/bastyp/init.cxx | 951 ++++++
sw/source/core/bastyp/makefile.mk | 111 +
sw/source/core/bastyp/ring.cxx | 148 +
sw/source/core/bastyp/swcache.cxx | 699 ++++
sw/source/core/bastyp/swrect.cxx | 303 ++
sw/source/core/bastyp/swregion.cxx | 293 ++
sw/source/core/bastyp/swtypes.cxx | 270 ++
sw/source/core/bastyp/tabcol.cxx | 127 +
sw/source/core/crsr/bookmrk.cxx | 180 ++
sw/source/core/crsr/callnk.cxx | 302 ++
sw/source/core/crsr/callnk.hxx | 88 +
sw/source/core/crsr/crbm.cxx | 281 ++
sw/source/core/crsr/crsrsh.cxx | 2831 ++++++++++++++++
sw/source/core/crsr/crstrvl.cxx | 1999 ++++++++++++
sw/source/core/crsr/crstrvl1.cxx | 122 +
sw/source/core/crsr/findattr.cxx | 1463 +++++++++
sw/source/core/crsr/findcoll.cxx | 153 +
sw/source/core/crsr/findfmt.cxx | 124 +
sw/source/core/crsr/findtxt.cxx | 421 +++
sw/source/core/crsr/makefile.mk | 148 +
sw/source/core/crsr/pam.cxx | 993 ++++++
sw/source/core/crsr/paminit.cxx | 168 +
sw/source/core/crsr/swcrsr.cxx | 1736 ++++++++++
sw/source/core/crsr/trvlcol.cxx | 168 +
sw/source/core/crsr/trvlfnfl.cxx | 521 +++
sw/source/core/crsr/trvlreg.cxx | 345 ++
sw/source/core/crsr/trvltbl.cxx | 770 +++++
sw/source/core/crsr/unocrsr.cxx | 290 ++
sw/source/core/crsr/viscrs.cxx | 1078 +++++++
sw/source/core/doc/acmplwrd.cxx | 303 ++
sw/source/core/doc/doc.cxx | 1312 ++++++++
sw/source/core/doc/docbasic.cxx | 314 ++
sw/source/core/doc/docbm.cxx | 1114 +++++++
sw/source/core/doc/docchart.cxx | 489 +++
sw/source/core/doc/doccomp.cxx | 1772 +++++++++++
sw/source/core/doc/doccorr.cxx | 578 ++++
sw/source/core/doc/docdde.cxx | 525 +++
sw/source/core/doc/docdesc.cxx | 1016 ++++++
sw/source/core/doc/docdraw.cxx | 671 ++++
sw/source/core/doc/docedt.cxx | 2252 +++++++++++++
sw/source/core/doc/docfld.cxx | 2880 +++++++++++++++++
sw/source/core/doc/docfly.cxx | 1038 ++++++
sw/source/core/doc/docfmt.cxx | 2167 +++++++++++++
sw/source/core/doc/docftn.cxx | 555 ++++
sw/source/core/doc/docglbl.cxx | 566 ++++
sw/source/core/doc/docglos.cxx | 189 ++
sw/source/core/doc/doclay.cxx | 1924 +++++++++++
sw/source/core/doc/docnew.cxx | 822 +++++
sw/source/core/doc/docnum.cxx | 2187 +++++++++++++
sw/source/core/doc/docredln.cxx | 3218 +++++++++++++++++++
sw/source/core/doc/docsort.cxx | 1060 ++++++
sw/source/core/doc/docstat.cxx | 105 +
sw/source/core/doc/doctxm.cxx | 2352 ++++++++++++++
sw/source/core/doc/extinput.cxx | 286 ++
sw/source/core/doc/fmtcol.cxx | 457 +++
sw/source/core/doc/ftnidx.cxx | 480 +++
sw/source/core/doc/gctable.cxx | 521 +++
sw/source/core/doc/htmltbl.cxx | 1943 +++++++++++
sw/source/core/doc/lineinfo.cxx | 182 ++
sw/source/core/doc/makefile.mk | 176 +
sw/source/core/doc/notxtfrm.cxx | 1691 ++++++++++
sw/source/core/doc/number.cxx | 1018 ++++++
sw/source/core/doc/poolfmt.cxx | 2767 ++++++++++++++++
sw/source/core/doc/sortopt.cxx | 134 +
sw/source/core/doc/swserv.cxx | 419 +++
sw/source/core/doc/tblafmt.cxx | 1055 ++++++
sw/source/core/doc/tblcpy.cxx | 630 ++++
sw/source/core/doc/tblrwcl.cxx | 4508 ++++++++++++++++++++++++++
sw/source/core/doc/visiturl.cxx | 201 ++
sw/source/core/docnode/makefile.mk | 120 +
sw/source/core/docnode/ndcopy.cxx | 1260 ++++++++
sw/source/core/docnode/ndindex.cxx | 203 ++
sw/source/core/docnode/ndnotxt.cxx | 184 ++
sw/source/core/docnode/ndnum.cxx | 390 +++
sw/source/core/docnode/ndsect.cxx | 1378 ++++++++
sw/source/core/docnode/ndtbl.cxx | 3824 ++++++++++++++++++++++
sw/source/core/docnode/ndtbl1.cxx | 1478 +++++++++
sw/source/core/docnode/node.cxx | 1840 +++++++++++
sw/source/core/docnode/node2lay.cxx | 422 +++
sw/source/core/docnode/nodes.cxx | 2604 +++++++++++++++
sw/source/core/docnode/section.cxx | 1559 +++++++++
sw/source/core/docnode/swbaslnk.cxx | 850 +++++
sw/source/core/draw/dcontact.cxx | 774 +++++
sw/source/core/draw/dflyobj.cxx | 707 ++++
sw/source/core/draw/dobjfac.cxx | 100 +
sw/source/core/draw/dpage.cxx | 375 +++
sw/source/core/draw/drawdoc.cxx | 279 ++
sw/source/core/draw/dview.cxx | 688 ++++
sw/source/core/draw/makefile.mk | 102 +
sw/source/core/edit/acorrect.cxx | 628 ++++
sw/source/core/edit/autofmt.cxx | 2770 ++++++++++++++++
sw/source/core/edit/edatmisc.cxx | 234 ++
sw/source/core/edit/edattr.cxx | 444 +++
sw/source/core/edit/eddel.cxx | 466 +++
sw/source/core/edit/edfcol.cxx | 194 ++
sw/source/core/edit/edfld.cxx | 739 +++++
sw/source/core/edit/edfmt.cxx | 277 ++
sw/source/core/edit/edglbldc.cxx | 470 +++
sw/source/core/edit/edglss.cxx | 442 +++
sw/source/core/edit/editsh.cxx | 1111 +++++++
sw/source/core/edit/edlingu.cxx | 961 ++++++
sw/source/core/edit/ednumber.cxx | 714 +++++
sw/source/core/edit/edredln.cxx | 228 ++
sw/source/core/edit/edsect.cxx | 501 +++
sw/source/core/edit/edtab.cxx | 713 +++++
sw/source/core/edit/edtox.cxx | 547 ++++
sw/source/core/edit/edundo.cxx | 312 ++
sw/source/core/edit/edws.cxx | 443 +++
sw/source/core/edit/makefile.mk | 145 +
sw/source/core/except/dbgloop.cxx | 201 ++
sw/source/core/except/errhdl.cxx | 196 ++
sw/source/core/except/makefile.mk | 97 +
sw/source/core/fields/authfld.cxx | 714 +++++
sw/source/core/fields/cellfml.cxx | 1305 ++++++++
sw/source/core/fields/chpfld.cxx | 297 ++
sw/source/core/fields/dbfld.cxx | 1112 +++++++
sw/source/core/fields/ddefld.cxx | 494 +++
sw/source/core/fields/ddetbl.cxx | 240 ++
sw/source/core/fields/docufld.cxx | 2485 +++++++++++++++
sw/source/core/fields/expfld.cxx | 1309 ++++++++
sw/source/core/fields/fldbas.cxx | 1024 ++++++
sw/source/core/fields/flddat.cxx | 364 +++
sw/source/core/fields/fldlst.cxx | 278 ++
sw/source/core/fields/macrofld.cxx | 226 ++
sw/source/core/fields/makefile.mk | 125 +
sw/source/core/fields/reffld.cxx | 898 ++++++
sw/source/core/fields/scrptfld.cxx | 182 ++
sw/source/core/fields/tblcalc.cxx | 280 ++
sw/source/core/fields/usrfld.cxx | 451 +++
sw/source/core/frmedt/fecopy.cxx | 1431 +++++++++
sw/source/core/frmedt/fedesc.cxx | 327 ++
sw/source/core/frmedt/fefly1.cxx | 1869 +++++++++++
sw/source/core/frmedt/feflyole.cxx | 194 ++
sw/source/core/frmedt/feshview.cxx | 2559 +++++++++++++++
sw/source/core/frmedt/fetab.cxx | 1659 ++++++++++
sw/source/core/frmedt/fews.cxx | 1000 ++++++
sw/source/core/frmedt/makefile.mk | 112 +
sw/source/core/frmedt/tblsel.cxx | 2593 +++++++++++++++
sw/source/core/graphic/grfatr.cxx | 417 +++
sw/source/core/graphic/makefile.mk | 105 +
sw/source/core/graphic/ndgrf.cxx | 2061 ++++++++++++
sw/source/core/inc/acorrect.hxx | 157 +
sw/source/core/inc/blink.hxx | 126 +
sw/source/core/inc/bodyfrm.hxx | 89 +
sw/source/core/inc/cellfrm.hxx | 96 +
sw/source/core/inc/cntfrm.hxx | 196 ++
sw/source/core/inc/colfrm.hxx | 83 +
sw/source/core/inc/dbg_lay.hxx | 144 +
sw/source/core/inc/dbgloop.hxx | 113 +
sw/source/core/inc/dflyobj.hxx | 156 +
sw/source/core/inc/docfld.hxx | 221 ++
sw/source/core/inc/docsort.hxx | 201 ++
sw/source/core/inc/doctxm.hxx | 176 +
sw/source/core/inc/drawdev.hxx | 174 +
sw/source/core/inc/drawfont.hxx | 348 ++
sw/source/core/inc/dview.hxx | 119 +
sw/source/core/inc/flowfrm.hxx | 216 ++
sw/source/core/inc/flyfrm.hxx | 248 ++
sw/source/core/inc/flyfrms.hxx | 207 ++
sw/source/core/inc/fntcache.hxx | 194 ++
sw/source/core/inc/frame.hxx | 919 ++++++
sw/source/core/inc/frminf.hxx | 119 +
sw/source/core/inc/frmtool.hxx | 457 +++
sw/source/core/inc/ftnboss.hxx | 158 +
sw/source/core/inc/ftnfrm.hxx | 156 +
sw/source/core/inc/hffrm.hxx | 102 +
sw/source/core/inc/layact.hxx | 267 ++
sw/source/core/inc/layfrm.hxx | 208 ++
sw/source/core/inc/layouter.hxx | 98 +
sw/source/core/inc/makefile.mk | 61 +
sw/source/core/inc/mvsave.hxx | 250 ++
sw/source/core/inc/node2lay.hxx | 110 +
sw/source/core/inc/noteurl.hxx | 116 +
sw/source/core/inc/notxtfrm.hxx | 119 +
sw/source/core/inc/pagefrm.hxx | 327 ++
sw/source/core/inc/pamtyp.hxx | 140 +
sw/source/core/inc/ptqueue.hxx | 96 +
sw/source/core/inc/rootfrm.hxx | 342 ++
sw/source/core/inc/rowfrm.hxx | 112 +
sw/source/core/inc/rvp_mark.hxx | 77 +
sw/source/core/inc/scrrect.hxx | 158 +
sw/source/core/inc/sectfrm.hxx | 197 ++
sw/source/core/inc/swblocks.hxx | 260 ++
sw/source/core/inc/swcache.hxx | 336 ++
sw/source/core/inc/swfntcch.hxx | 133 +
sw/source/core/inc/swfont.hxx | 850 +++++
sw/source/core/inc/tabfrm.hxx | 190 ++
sw/source/core/inc/tblrwcl.hxx | 263 ++
sw/source/core/inc/txmsrt.hxx | 243 ++
sw/source/core/inc/txtfrm.hxx | 639 ++++
sw/source/core/inc/txttypes.hxx | 75 +
sw/source/core/inc/unoclbck.hxx | 85 +
sw/source/core/inc/viewimp.hxx | 269 ++
sw/source/core/inc/visiturl.hxx | 85 +
sw/source/core/inc/wrong.hxx | 121 +
sw/source/core/layout/atrfrm.cxx | 2519 +++++++++++++++
sw/source/core/layout/calcmove.cxx | 1551 +++++++++
sw/source/core/layout/colfrm.cxx | 469 +++
sw/source/core/layout/dbg_lay.cxx | 813 +++++
sw/source/core/layout/findfrm.cxx | 1116 +++++++
sw/source/core/layout/flowfrm.cxx | 1837 +++++++++++
sw/source/core/layout/fly.cxx | 2202 +++++++++++++
sw/source/core/layout/flycnt.cxx | 1970 ++++++++++++
sw/source/core/layout/flyincnt.cxx | 369 +++
sw/source/core/layout/flylay.cxx | 997 ++++++
sw/source/core/layout/flypos.cxx | 147 +
sw/source/core/layout/frmtool.cxx | 3171 ++++++++++++++++++
sw/source/core/layout/ftnfrm.cxx | 2931 +++++++++++++++++
sw/source/core/layout/hffrm.cxx | 438 +++
sw/source/core/layout/layact.cxx | 2741 ++++++++++++++++
sw/source/core/layout/layouter.cxx | 345 ++
sw/source/core/layout/makefile.mk | 175 +
sw/source/core/layout/newfrm.cxx | 441 +++
sw/source/core/layout/pagechg.cxx | 1955 ++++++++++++
sw/source/core/layout/pagedesc.cxx | 482 +++
sw/source/core/layout/paintfrm.cxx | 3904 +++++++++++++++++++++++
sw/source/core/layout/sectfrm.cxx | 2483 +++++++++++++++
sw/source/core/layout/ssfrm.cxx | 345 ++
sw/source/core/layout/tabfrm.cxx | 2573 +++++++++++++++
sw/source/core/layout/trvlfrm.cxx | 2075 ++++++++++++
sw/source/core/layout/unusedf.cxx | 122 +
sw/source/core/layout/virtoutp.cxx | 247 ++
sw/source/core/layout/virtoutp.hxx | 108 +
sw/source/core/layout/wsfrm.cxx | 3113 ++++++++++++++++++
sw/source/core/makefile.mk | 326 ++
sw/source/core/ole/makefile.mk | 93 +
sw/source/core/ole/ndole.cxx | 644 ++++
sw/source/core/para/makefile.mk | 93 +
sw/source/core/para/paratr.cxx | 349 ++
sw/source/core/sw3io/makefile.mk | 136 +
sw/source/core/sw3io/swacorr.cxx | 145 +
sw/source/core/swg/makefile.mk | 124 +
sw/source/core/swg/swblocks.cxx | 955 ++++++
sw/source/core/text/blink.cxx | 205 ++
sw/source/core/text/frmcrsr.cxx | 1240 +++++++
sw/source/core/text/frmform.cxx | 1919 +++++++++++
sw/source/core/text/frminf.cxx | 409 +++
sw/source/core/text/frmpaint.cxx | 738 +++++
sw/source/core/text/guess.cxx | 492 +++
sw/source/core/text/guess.hxx | 123 +
sw/source/core/text/inftxt.cxx | 1176 +++++++
sw/source/core/text/inftxt.hxx | 807 +++++
sw/source/core/text/itradj.cxx | 578 ++++
sw/source/core/text/itratr.cxx | 833 +++++
sw/source/core/text/itratr.hxx | 149 +
sw/source/core/text/itrcrsr.cxx | 923 ++++++
sw/source/core/text/itrform2.cxx | 1491 +++++++++
sw/source/core/text/itrform2.hxx | 236 ++
sw/source/core/text/itrpaint.cxx | 548 ++++
sw/source/core/text/itrpaint.hxx | 97 +
sw/source/core/text/itrtxt.cxx | 489 +++
sw/source/core/text/itrtxt.hxx | 363 +++
sw/source/core/text/makefile.mk | 185 ++
sw/source/core/text/noteurl.cxx | 129 +
sw/source/core/text/pordrop.hxx | 122 +
sw/source/core/text/porexp.cxx | 332 ++
sw/source/core/text/porexp.hxx | 131 +
sw/source/core/text/porfld.cxx | 854 +++++
sw/source/core/text/porfld.hxx | 240 ++
sw/source/core/text/porfly.cxx | 585 ++++
sw/source/core/text/porfly.hxx | 140 +
sw/source/core/text/porftn.hxx | 150 +
sw/source/core/text/porglue.cxx | 363 +++
sw/source/core/text/porglue.hxx | 174 +
sw/source/core/text/porhyph.hxx | 141 +
sw/source/core/text/porlay.cxx | 504 +++
sw/source/core/text/porlay.hxx | 390 +++
sw/source/core/text/porlin.cxx | 405 +++
sw/source/core/text/porlin.hxx | 329 ++
sw/source/core/text/porref.cxx | 139 +
sw/source/core/text/porref.hxx | 106 +
sw/source/core/text/porrst.cxx | 547 ++++
sw/source/core/text/porrst.hxx | 149 +
sw/source/core/text/portab.hxx | 159 +
sw/source/core/text/portox.cxx | 140 +
sw/source/core/text/portox.hxx | 108 +
sw/source/core/text/portxt.cxx | 745 +++++
sw/source/core/text/portxt.hxx | 139 +
sw/source/core/text/possiz.hxx | 120 +
sw/source/core/text/redlnitr.cxx | 558 ++++
sw/source/core/text/redlnitr.hxx | 150 +
sw/source/core/text/txtcache.cxx | 277 ++
sw/source/core/text/txtcache.hxx | 113 +
sw/source/core/text/txtcfg.hxx | 209 ++
sw/source/core/text/txtdrop.cxx | 800 +++++
sw/source/core/text/txtfld.cxx | 534 ++++
sw/source/core/text/txtfly.cxx | 1913 +++++++++++
sw/source/core/text/txtfly.hxx | 275 ++
sw/source/core/text/txtfrm.cxx | 1834 +++++++++++
sw/source/core/text/txtftn.cxx | 1542 +++++++++
sw/source/core/text/txthyph.cxx | 910 ++++++
sw/source/core/text/txtinit.cxx | 151 +
sw/source/core/text/txtio.cxx | 1134 +++++++
sw/source/core/text/txtpaint.cxx | 144 +
sw/source/core/text/txtpaint.hxx | 259 ++
sw/source/core/text/txttab.cxx | 537 ++++
sw/source/core/text/widorp.cxx | 525 +++
sw/source/core/text/widorp.hxx | 125 +
sw/source/core/text/wrong.cxx | 370 +++
sw/source/core/tox/makefile.mk | 103 +
sw/source/core/tox/tox.cxx | 1261 ++++++++
sw/source/core/tox/txmsrt.cxx | 818 +++++
sw/source/core/txtnode/atrfld.cxx | 376 +++
sw/source/core/txtnode/atrflyin.cxx | 327 ++
sw/source/core/txtnode/atrftn.cxx | 554 ++++
sw/source/core/txtnode/atrref.cxx | 151 +
sw/source/core/txtnode/atrtox.cxx | 144 +
sw/source/core/txtnode/chrfmt.cxx | 76 +
sw/source/core/txtnode/fmtatr1.cxx | 133 +
sw/source/core/txtnode/fmtatr2.cxx | 381 +++
sw/source/core/txtnode/fntcache.cxx | 1208 +++++++
sw/source/core/txtnode/fntcap.cxx | 658 ++++
sw/source/core/txtnode/makefile.mk | 145 +
sw/source/core/txtnode/ndhints.cxx | 464 +++
sw/source/core/txtnode/ndtxt.cxx | 2738 ++++++++++++++++
sw/source/core/txtnode/swfntcch.cxx | 123 +
sw/source/core/txtnode/swfont.cxx | 1103 +++++++
sw/source/core/txtnode/thints.cxx | 2138 +++++++++++++
sw/source/core/txtnode/txatbase.cxx | 130 +
sw/source/core/txtnode/txtatr2.cxx | 630 ++++
sw/source/core/txtnode/txtedt.cxx | 1040 ++++++
sw/source/core/undo/docundo.cxx | 807 +++++
sw/source/core/undo/makefile.mk | 135 +
sw/source/core/undo/rolbck.cxx | 1488 +++++++++
sw/source/core/undo/unattr.cxx | 1356 ++++++++
sw/source/core/undo/unbkmk.cxx | 225 ++
sw/source/core/undo/undel.cxx | 970 ++++++
sw/source/core/undo/undobj.cxx | 1276 ++++++++
sw/source/core/undo/undobj1.cxx | 778 +++++
sw/source/core/undo/undraw.cxx | 779 +++++
sw/source/core/undo/unfmco.cxx | 202 ++
sw/source/core/undo/unins.cxx | 1214 +++++++
sw/source/core/undo/unmove.cxx | 505 +++
sw/source/core/undo/unnum.cxx | 588 ++++
sw/source/core/undo/unoutl.cxx | 153 +
sw/source/core/undo/unovwr.cxx | 407 +++
sw/source/core/undo/unredln.cxx | 579 ++++
sw/source/core/undo/unsect.cxx | 627 ++++
sw/source/core/undo/unsort.cxx | 422 +++
sw/source/core/undo/unspnd.cxx | 380 +++
sw/source/core/undo/untbl.cxx | 3123 ++++++++++++++++++
sw/source/core/undo/untblk.cxx | 489 +++
sw/source/core/unocore/makefile.mk | 152 +
sw/source/core/unocore/unobkm.cxx | 431 +++
sw/source/core/unocore/unoclbck.cxx | 230 ++
sw/source/core/unocore/unocoll.cxx | 2408 ++++++++++++++
sw/source/core/unocore/unodraw.cxx | 1420 +++++++++
sw/source/core/unocore/unofield.cxx | 3230 +++++++++++++++++++
sw/source/core/unocore/unoframe.cxx | 2669 ++++++++++++++++
sw/source/core/unocore/unoftn.cxx | 644 ++++
sw/source/core/unocore/unoidx.cxx | 2742 ++++++++++++++++
sw/source/core/unocore/unomap.cxx | 1921 +++++++++++
sw/source/core/unocore/unoobj.cxx | 6024 +++++++++++++++++++++++++++++++++++
sw/source/core/unocore/unoport.cxx | 704 ++++
sw/source/core/unocore/unoprnms.cxx | 529 +++
sw/source/core/unocore/unorefmk.cxx | 496 +++
sw/source/core/unocore/unosect.cxx | 858 +++++
sw/source/core/unocore/unosett.cxx | 2528 +++++++++++++++
sw/source/core/unocore/unosrch.cxx | 889 ++++++
sw/source/core/unocore/unostyle.cxx | 2861 +++++++++++++++++
sw/source/core/unocore/unotbl.cxx | 4783 +++++++++++++++++++++++++++
sw/source/core/unocore/unotext.cxx | 1534 +++++++++
sw/source/core/view/makefile.mk | 111 +
sw/source/core/view/scrrect.cxx | 934 ++++++
sw/source/core/view/vdraw.cxx | 606 ++++
sw/source/core/view/viewimp.cxx | 478 +++
sw/source/core/view/viewpg.cxx | 1472 +++++++++
sw/source/core/view/viewsh.cxx | 2154 +++++++++++++
sw/source/core/view/vnew.cxx | 520 +++
sw/source/core/view/vprint.cxx | 1924 +++++++++++
380 files changed, 291878 insertions(+)
create mode 100644 sw/source/core/attr/calbck.cxx
create mode 100644 sw/source/core/attr/cellatr.cxx
create mode 100644 sw/source/core/attr/format.cxx
create mode 100644 sw/source/core/attr/hints.cxx
create mode 100644 sw/source/core/attr/makefile.mk
create mode 100644 sw/source/core/attr/swatrset.cxx
create mode 100644 sw/source/core/bastyp/bparr.cxx
create mode 100644 sw/source/core/bastyp/breakit.cxx
create mode 100644 sw/source/core/bastyp/calc.cxx
create mode 100644 sw/source/core/bastyp/index.cxx
create mode 100644 sw/source/core/bastyp/init.cxx
create mode 100644 sw/source/core/bastyp/makefile.mk
create mode 100644 sw/source/core/bastyp/ring.cxx
create mode 100644 sw/source/core/bastyp/swcache.cxx
create mode 100644 sw/source/core/bastyp/swrect.cxx
create mode 100644 sw/source/core/bastyp/swregion.cxx
create mode 100644 sw/source/core/bastyp/swtypes.cxx
create mode 100644 sw/source/core/bastyp/tabcol.cxx
create mode 100644 sw/source/core/crsr/bookmrk.cxx
create mode 100644 sw/source/core/crsr/callnk.cxx
create mode 100644 sw/source/core/crsr/callnk.hxx
create mode 100644 sw/source/core/crsr/crbm.cxx
create mode 100644 sw/source/core/crsr/crsrsh.cxx
create mode 100644 sw/source/core/crsr/crstrvl.cxx
create mode 100644 sw/source/core/crsr/crstrvl1.cxx
create mode 100644 sw/source/core/crsr/findattr.cxx
create mode 100644 sw/source/core/crsr/findcoll.cxx
create mode 100644 sw/source/core/crsr/findfmt.cxx
create mode 100644 sw/source/core/crsr/findtxt.cxx
create mode 100644 sw/source/core/crsr/makefile.mk
create mode 100644 sw/source/core/crsr/pam.cxx
create mode 100644 sw/source/core/crsr/paminit.cxx
create mode 100644 sw/source/core/crsr/swcrsr.cxx
create mode 100644 sw/source/core/crsr/trvlcol.cxx
create mode 100644 sw/source/core/crsr/trvlfnfl.cxx
create mode 100644 sw/source/core/crsr/trvlreg.cxx
create mode 100644 sw/source/core/crsr/trvltbl.cxx
create mode 100644 sw/source/core/crsr/unocrsr.cxx
create mode 100644 sw/source/core/crsr/viscrs.cxx
create mode 100644 sw/source/core/doc/acmplwrd.cxx
create mode 100644 sw/source/core/doc/doc.cxx
create mode 100644 sw/source/core/doc/docbasic.cxx
create mode 100644 sw/source/core/doc/docbm.cxx
create mode 100644 sw/source/core/doc/docchart.cxx
create mode 100644 sw/source/core/doc/doccomp.cxx
create mode 100644 sw/source/core/doc/doccorr.cxx
create mode 100644 sw/source/core/doc/docdde.cxx
create mode 100644 sw/source/core/doc/docdesc.cxx
create mode 100644 sw/source/core/doc/docdraw.cxx
create mode 100644 sw/source/core/doc/docedt.cxx
create mode 100644 sw/source/core/doc/docfld.cxx
create mode 100644 sw/source/core/doc/docfly.cxx
create mode 100644 sw/source/core/doc/docfmt.cxx
create mode 100644 sw/source/core/doc/docftn.cxx
create mode 100644 sw/source/core/doc/docglbl.cxx
create mode 100644 sw/source/core/doc/docglos.cxx
create mode 100644 sw/source/core/doc/doclay.cxx
create mode 100644 sw/source/core/doc/docnew.cxx
create mode 100644 sw/source/core/doc/docnum.cxx
create mode 100644 sw/source/core/doc/docredln.cxx
create mode 100644 sw/source/core/doc/docsort.cxx
create mode 100644 sw/source/core/doc/docstat.cxx
create mode 100644 sw/source/core/doc/doctxm.cxx
create mode 100644 sw/source/core/doc/extinput.cxx
create mode 100644 sw/source/core/doc/fmtcol.cxx
create mode 100644 sw/source/core/doc/ftnidx.cxx
create mode 100644 sw/source/core/doc/gctable.cxx
create mode 100644 sw/source/core/doc/htmltbl.cxx
create mode 100644 sw/source/core/doc/lineinfo.cxx
create mode 100644 sw/source/core/doc/makefile.mk
create mode 100644 sw/source/core/doc/notxtfrm.cxx
create mode 100644 sw/source/core/doc/number.cxx
create mode 100644 sw/source/core/doc/poolfmt.cxx
create mode 100644 sw/source/core/doc/sortopt.cxx
create mode 100644 sw/source/core/doc/swserv.cxx
create mode 100644 sw/source/core/doc/tblafmt.cxx
create mode 100644 sw/source/core/doc/tblcpy.cxx
create mode 100644 sw/source/core/doc/tblrwcl.cxx
create mode 100644 sw/source/core/doc/visiturl.cxx
create mode 100644 sw/source/core/docnode/makefile.mk
create mode 100644 sw/source/core/docnode/ndcopy.cxx
create mode 100644 sw/source/core/docnode/ndindex.cxx
create mode 100644 sw/source/core/docnode/ndnotxt.cxx
create mode 100644 sw/source/core/docnode/ndnum.cxx
create mode 100644 sw/source/core/docnode/ndsect.cxx
create mode 100644 sw/source/core/docnode/ndtbl.cxx
create mode 100644 sw/source/core/docnode/ndtbl1.cxx
create mode 100644 sw/source/core/docnode/node.cxx
create mode 100644 sw/source/core/docnode/node2lay.cxx
create mode 100644 sw/source/core/docnode/nodes.cxx
create mode 100644 sw/source/core/docnode/section.cxx
create mode 100644 sw/source/core/docnode/swbaslnk.cxx
create mode 100644 sw/source/core/draw/dcontact.cxx
create mode 100644 sw/source/core/draw/dflyobj.cxx
create mode 100644 sw/source/core/draw/dobjfac.cxx
create mode 100644 sw/source/core/draw/dpage.cxx
create mode 100644 sw/source/core/draw/drawdoc.cxx
create mode 100644 sw/source/core/draw/dview.cxx
create mode 100644 sw/source/core/draw/makefile.mk
create mode 100644 sw/source/core/edit/acorrect.cxx
create mode 100644 sw/source/core/edit/autofmt.cxx
create mode 100644 sw/source/core/edit/edatmisc.cxx
create mode 100644 sw/source/core/edit/edattr.cxx
create mode 100644 sw/source/core/edit/eddel.cxx
create mode 100644 sw/source/core/edit/edfcol.cxx
create mode 100644 sw/source/core/edit/edfld.cxx
create mode 100644 sw/source/core/edit/edfmt.cxx
create mode 100644 sw/source/core/edit/edglbldc.cxx
create mode 100644 sw/source/core/edit/edglss.cxx
create mode 100644 sw/source/core/edit/editsh.cxx
create mode 100644 sw/source/core/edit/edlingu.cxx
create mode 100644 sw/source/core/edit/ednumber.cxx
create mode 100644 sw/source/core/edit/edredln.cxx
create mode 100644 sw/source/core/edit/edsect.cxx
create mode 100644 sw/source/core/edit/edtab.cxx
create mode 100644 sw/source/core/edit/edtox.cxx
create mode 100644 sw/source/core/edit/edundo.cxx
create mode 100644 sw/source/core/edit/edws.cxx
create mode 100644 sw/source/core/edit/makefile.mk
create mode 100644 sw/source/core/except/dbgloop.cxx
create mode 100644 sw/source/core/except/errhdl.cxx
create mode 100644 sw/source/core/except/makefile.mk
create mode 100644 sw/source/core/fields/authfld.cxx
create mode 100644 sw/source/core/fields/cellfml.cxx
create mode 100644 sw/source/core/fields/chpfld.cxx
create mode 100644 sw/source/core/fields/dbfld.cxx
create mode 100644 sw/source/core/fields/ddefld.cxx
create mode 100644 sw/source/core/fields/ddetbl.cxx
create mode 100644 sw/source/core/fields/docufld.cxx
create mode 100644 sw/source/core/fields/expfld.cxx
create mode 100644 sw/source/core/fields/fldbas.cxx
create mode 100644 sw/source/core/fields/flddat.cxx
create mode 100644 sw/source/core/fields/fldlst.cxx
create mode 100644 sw/source/core/fields/macrofld.cxx
create mode 100644 sw/source/core/fields/makefile.mk
create mode 100644 sw/source/core/fields/reffld.cxx
create mode 100644 sw/source/core/fields/scrptfld.cxx
create mode 100644 sw/source/core/fields/tblcalc.cxx
create mode 100644 sw/source/core/fields/usrfld.cxx
create mode 100644 sw/source/core/frmedt/fecopy.cxx
create mode 100644 sw/source/core/frmedt/fedesc.cxx
create mode 100644 sw/source/core/frmedt/fefly1.cxx
create mode 100644 sw/source/core/frmedt/feflyole.cxx
create mode 100644 sw/source/core/frmedt/feshview.cxx
create mode 100644 sw/source/core/frmedt/fetab.cxx
create mode 100644 sw/source/core/frmedt/fews.cxx
create mode 100644 sw/source/core/frmedt/makefile.mk
create mode 100644 sw/source/core/frmedt/tblsel.cxx
create mode 100644 sw/source/core/graphic/grfatr.cxx
create mode 100644 sw/source/core/graphic/makefile.mk
create mode 100644 sw/source/core/graphic/ndgrf.cxx
create mode 100644 sw/source/core/inc/acorrect.hxx
create mode 100644 sw/source/core/inc/blink.hxx
create mode 100644 sw/source/core/inc/bodyfrm.hxx
create mode 100644 sw/source/core/inc/cellfrm.hxx
create mode 100644 sw/source/core/inc/cntfrm.hxx
create mode 100644 sw/source/core/inc/colfrm.hxx
create mode 100644 sw/source/core/inc/dbg_lay.hxx
create mode 100644 sw/source/core/inc/dbgloop.hxx
create mode 100644 sw/source/core/inc/dflyobj.hxx
create mode 100644 sw/source/core/inc/docfld.hxx
create mode 100644 sw/source/core/inc/docsort.hxx
create mode 100644 sw/source/core/inc/doctxm.hxx
create mode 100644 sw/source/core/inc/drawdev.hxx
create mode 100644 sw/source/core/inc/drawfont.hxx
create mode 100644 sw/source/core/inc/dview.hxx
create mode 100644 sw/source/core/inc/flowfrm.hxx
create mode 100644 sw/source/core/inc/flyfrm.hxx
create mode 100644 sw/source/core/inc/flyfrms.hxx
create mode 100644 sw/source/core/inc/fntcache.hxx
create mode 100644 sw/source/core/inc/frame.hxx
create mode 100644 sw/source/core/inc/frminf.hxx
create mode 100644 sw/source/core/inc/frmtool.hxx
create mode 100644 sw/source/core/inc/ftnboss.hxx
create mode 100644 sw/source/core/inc/ftnfrm.hxx
create mode 100644 sw/source/core/inc/hffrm.hxx
create mode 100644 sw/source/core/inc/layact.hxx
create mode 100644 sw/source/core/inc/layfrm.hxx
create mode 100644 sw/source/core/inc/layouter.hxx
create mode 100644 sw/source/core/inc/makefile.mk
create mode 100644 sw/source/core/inc/mvsave.hxx
create mode 100644 sw/source/core/inc/node2lay.hxx
create mode 100644 sw/source/core/inc/noteurl.hxx
create mode 100644 sw/source/core/inc/notxtfrm.hxx
create mode 100644 sw/source/core/inc/pagefrm.hxx
create mode 100644 sw/source/core/inc/pamtyp.hxx
create mode 100644 sw/source/core/inc/ptqueue.hxx
create mode 100644 sw/source/core/inc/rootfrm.hxx
create mode 100644 sw/source/core/inc/rowfrm.hxx
create mode 100644 sw/source/core/inc/rvp_mark.hxx
create mode 100644 sw/source/core/inc/scrrect.hxx
create mode 100644 sw/source/core/inc/sectfrm.hxx
create mode 100644 sw/source/core/inc/swblocks.hxx
create mode 100644 sw/source/core/inc/swcache.hxx
create mode 100644 sw/source/core/inc/swfntcch.hxx
create mode 100644 sw/source/core/inc/swfont.hxx
create mode 100644 sw/source/core/inc/tabfrm.hxx
create mode 100644 sw/source/core/inc/tblrwcl.hxx
create mode 100644 sw/source/core/inc/txmsrt.hxx
create mode 100644 sw/source/core/inc/txtfrm.hxx
create mode 100644 sw/source/core/inc/txttypes.hxx
create mode 100644 sw/source/core/inc/unoclbck.hxx
create mode 100644 sw/source/core/inc/viewimp.hxx
create mode 100644 sw/source/core/inc/visiturl.hxx
create mode 100644 sw/source/core/inc/wrong.hxx
create mode 100644 sw/source/core/layout/atrfrm.cxx
create mode 100644 sw/source/core/layout/calcmove.cxx
create mode 100644 sw/source/core/layout/colfrm.cxx
create mode 100644 sw/source/core/layout/dbg_lay.cxx
create mode 100644 sw/source/core/layout/findfrm.cxx
create mode 100644 sw/source/core/layout/flowfrm.cxx
create mode 100644 sw/source/core/layout/fly.cxx
create mode 100644 sw/source/core/layout/flycnt.cxx
create mode 100644 sw/source/core/layout/flyincnt.cxx
create mode 100644 sw/source/core/layout/flylay.cxx
create mode 100644 sw/source/core/layout/flypos.cxx
create mode 100644 sw/source/core/layout/frmtool.cxx
create mode 100644 sw/source/core/layout/ftnfrm.cxx
create mode 100644 sw/source/core/layout/hffrm.cxx
create mode 100644 sw/source/core/layout/layact.cxx
create mode 100644 sw/source/core/layout/layouter.cxx
create mode 100644 sw/source/core/layout/makefile.mk
create mode 100644 sw/source/core/layout/newfrm.cxx
create mode 100644 sw/source/core/layout/pagechg.cxx
create mode 100644 sw/source/core/layout/pagedesc.cxx
create mode 100644 sw/source/core/layout/paintfrm.cxx
create mode 100644 sw/source/core/layout/sectfrm.cxx
create mode 100644 sw/source/core/layout/ssfrm.cxx
create mode 100644 sw/source/core/layout/tabfrm.cxx
create mode 100644 sw/source/core/layout/trvlfrm.cxx
create mode 100644 sw/source/core/layout/unusedf.cxx
create mode 100644 sw/source/core/layout/virtoutp.cxx
create mode 100644 sw/source/core/layout/virtoutp.hxx
create mode 100644 sw/source/core/layout/wsfrm.cxx
create mode 100644 sw/source/core/makefile.mk
create mode 100644 sw/source/core/ole/makefile.mk
create mode 100644 sw/source/core/ole/ndole.cxx
create mode 100644 sw/source/core/para/makefile.mk
create mode 100644 sw/source/core/para/paratr.cxx
create mode 100644 sw/source/core/sw3io/makefile.mk
create mode 100644 sw/source/core/sw3io/swacorr.cxx
create mode 100644 sw/source/core/swg/makefile.mk
create mode 100644 sw/source/core/swg/swblocks.cxx
create mode 100644 sw/source/core/text/blink.cxx
create mode 100644 sw/source/core/text/frmcrsr.cxx
create mode 100644 sw/source/core/text/frmform.cxx
create mode 100644 sw/source/core/text/frminf.cxx
create mode 100644 sw/source/core/text/frmpaint.cxx
create mode 100644 sw/source/core/text/guess.cxx
create mode 100644 sw/source/core/text/guess.hxx
create mode 100644 sw/source/core/text/inftxt.cxx
create mode 100644 sw/source/core/text/inftxt.hxx
create mode 100644 sw/source/core/text/itradj.cxx
create mode 100644 sw/source/core/text/itratr.cxx
create mode 100644 sw/source/core/text/itratr.hxx
create mode 100644 sw/source/core/text/itrcrsr.cxx
create mode 100644 sw/source/core/text/itrform2.cxx
create mode 100644 sw/source/core/text/itrform2.hxx
create mode 100644 sw/source/core/text/itrpaint.cxx
create mode 100644 sw/source/core/text/itrpaint.hxx
create mode 100644 sw/source/core/text/itrtxt.cxx
create mode 100644 sw/source/core/text/itrtxt.hxx
create mode 100644 sw/source/core/text/makefile.mk
create mode 100644 sw/source/core/text/noteurl.cxx
create mode 100644 sw/source/core/text/pordrop.hxx
create mode 100644 sw/source/core/text/porexp.cxx
create mode 100644 sw/source/core/text/porexp.hxx
create mode 100644 sw/source/core/text/porfld.cxx
create mode 100644 sw/source/core/text/porfld.hxx
create mode 100644 sw/source/core/text/porfly.cxx
create mode 100644 sw/source/core/text/porfly.hxx
create mode 100644 sw/source/core/text/porftn.hxx
create mode 100644 sw/source/core/text/porglue.cxx
create mode 100644 sw/source/core/text/porglue.hxx
create mode 100644 sw/source/core/text/porhyph.hxx
create mode 100644 sw/source/core/text/porlay.cxx
create mode 100644 sw/source/core/text/porlay.hxx
create mode 100644 sw/source/core/text/porlin.cxx
create mode 100644 sw/source/core/text/porlin.hxx
create mode 100644 sw/source/core/text/porref.cxx
create mode 100644 sw/source/core/text/porref.hxx
create mode 100644 sw/source/core/text/porrst.cxx
create mode 100644 sw/source/core/text/porrst.hxx
create mode 100644 sw/source/core/text/portab.hxx
create mode 100644 sw/source/core/text/portox.cxx
create mode 100644 sw/source/core/text/portox.hxx
create mode 100644 sw/source/core/text/portxt.cxx
create mode 100644 sw/source/core/text/portxt.hxx
create mode 100644 sw/source/core/text/possiz.hxx
create mode 100644 sw/source/core/text/redlnitr.cxx
create mode 100644 sw/source/core/text/redlnitr.hxx
create mode 100644 sw/source/core/text/txtcache.cxx
create mode 100644 sw/source/core/text/txtcache.hxx
create mode 100644 sw/source/core/text/txtcfg.hxx
create mode 100644 sw/source/core/text/txtdrop.cxx
create mode 100644 sw/source/core/text/txtfld.cxx
create mode 100644 sw/source/core/text/txtfly.cxx
create mode 100644 sw/source/core/text/txtfly.hxx
create mode 100644 sw/source/core/text/txtfrm.cxx
create mode 100644 sw/source/core/text/txtftn.cxx
create mode 100644 sw/source/core/text/txthyph.cxx
create mode 100644 sw/source/core/text/txtinit.cxx
create mode 100644 sw/source/core/text/txtio.cxx
create mode 100644 sw/source/core/text/txtpaint.cxx
create mode 100644 sw/source/core/text/txtpaint.hxx
create mode 100644 sw/source/core/text/txttab.cxx
create mode 100644 sw/source/core/text/widorp.cxx
create mode 100644 sw/source/core/text/widorp.hxx
create mode 100644 sw/source/core/text/wrong.cxx
create mode 100644 sw/source/core/tox/makefile.mk
create mode 100644 sw/source/core/tox/tox.cxx
create mode 100644 sw/source/core/tox/txmsrt.cxx
create mode 100644 sw/source/core/txtnode/atrfld.cxx
create mode 100644 sw/source/core/txtnode/atrflyin.cxx
create mode 100644 sw/source/core/txtnode/atrftn.cxx
create mode 100644 sw/source/core/txtnode/atrref.cxx
create mode 100644 sw/source/core/txtnode/atrtox.cxx
create mode 100644 sw/source/core/txtnode/chrfmt.cxx
create mode 100644 sw/source/core/txtnode/fmtatr1.cxx
create mode 100644 sw/source/core/txtnode/fmtatr2.cxx
create mode 100644 sw/source/core/txtnode/fntcache.cxx
create mode 100644 sw/source/core/txtnode/fntcap.cxx
create mode 100644 sw/source/core/txtnode/makefile.mk
create mode 100644 sw/source/core/txtnode/ndhints.cxx
create mode 100644 sw/source/core/txtnode/ndtxt.cxx
create mode 100644 sw/source/core/txtnode/swfntcch.cxx
create mode 100644 sw/source/core/txtnode/swfont.cxx
create mode 100644 sw/source/core/txtnode/thints.cxx
create mode 100644 sw/source/core/txtnode/txatbase.cxx
create mode 100644 sw/source/core/txtnode/txtatr2.cxx
create mode 100644 sw/source/core/txtnode/txtedt.cxx
create mode 100644 sw/source/core/undo/docundo.cxx
create mode 100644 sw/source/core/undo/makefile.mk
create mode 100644 sw/source/core/undo/rolbck.cxx
create mode 100644 sw/source/core/undo/unattr.cxx
create mode 100644 sw/source/core/undo/unbkmk.cxx
create mode 100644 sw/source/core/undo/undel.cxx
create mode 100644 sw/source/core/undo/undobj.cxx
create mode 100644 sw/source/core/undo/undobj1.cxx
create mode 100644 sw/source/core/undo/undraw.cxx
create mode 100644 sw/source/core/undo/unfmco.cxx
create mode 100644 sw/source/core/undo/unins.cxx
create mode 100644 sw/source/core/undo/unmove.cxx
create mode 100644 sw/source/core/undo/unnum.cxx
create mode 100644 sw/source/core/undo/unoutl.cxx
create mode 100644 sw/source/core/undo/unovwr.cxx
create mode 100644 sw/source/core/undo/unredln.cxx
create mode 100644 sw/source/core/undo/unsect.cxx
create mode 100644 sw/source/core/undo/unsort.cxx
create mode 100644 sw/source/core/undo/unspnd.cxx
create mode 100644 sw/source/core/undo/untbl.cxx
create mode 100644 sw/source/core/undo/untblk.cxx
create mode 100644 sw/source/core/unocore/makefile.mk
create mode 100644 sw/source/core/unocore/unobkm.cxx
create mode 100644 sw/source/core/unocore/unoclbck.cxx
create mode 100644 sw/source/core/unocore/unocoll.cxx
create mode 100644 sw/source/core/unocore/unodraw.cxx
create mode 100644 sw/source/core/unocore/unofield.cxx
create mode 100644 sw/source/core/unocore/unoframe.cxx
create mode 100644 sw/source/core/unocore/unoftn.cxx
create mode 100644 sw/source/core/unocore/unoidx.cxx
create mode 100644 sw/source/core/unocore/unomap.cxx
create mode 100644 sw/source/core/unocore/unoobj.cxx
create mode 100644 sw/source/core/unocore/unoport.cxx
create mode 100644 sw/source/core/unocore/unoprnms.cxx
create mode 100644 sw/source/core/unocore/unorefmk.cxx
create mode 100644 sw/source/core/unocore/unosect.cxx
create mode 100644 sw/source/core/unocore/unosett.cxx
create mode 100644 sw/source/core/unocore/unosrch.cxx
create mode 100644 sw/source/core/unocore/unostyle.cxx
create mode 100644 sw/source/core/unocore/unotbl.cxx
create mode 100644 sw/source/core/unocore/unotext.cxx
create mode 100644 sw/source/core/view/makefile.mk
create mode 100644 sw/source/core/view/scrrect.cxx
create mode 100644 sw/source/core/view/vdraw.cxx
create mode 100644 sw/source/core/view/viewimp.cxx
create mode 100644 sw/source/core/view/viewpg.cxx
create mode 100644 sw/source/core/view/viewsh.cxx
create mode 100644 sw/source/core/view/vnew.cxx
create mode 100644 sw/source/core/view/vprint.cxx
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
new file mode 100644
index 000000000000..e8caa63045d5
--- /dev/null
+++ b/sw/source/core/attr/calbck.cxx
@@ -0,0 +1,642 @@
+/*************************************************************************
+ *
+ * $RCSfile: calbck.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include "hintids.hxx" // fuer RES_..
+#include "frame.hxx"
+#include "errhdl.hxx"
+#include "hints.hxx"
+
+#define ITERATION // iterative SwModify::_Insert-Methode
+#include "calbck.hxx"
+#include "swcache.hxx"
+#include "swfntcch.hxx"
+
+static SwClientIter* pClientIters = 0;
+
+
+TYPEINIT0(SwClient); //rtti
+
+/*************************************************************************
+|* SwClient::SwClient(SwModify *)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung MA 20. Mar. 95
+*************************************************************************/
+
+
+SwClient::SwClient(SwModify *pToRegisterIn)
+ : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 )
+{
+ bModifyLocked =
+ bInModify =
+ bInDocDTOR =
+ bInCache = FALSE;
+ bInSwFntCache = FALSE;
+
+ if(pToRegisterIn)
+ pToRegisterIn->Add(this);
+}
+
+/*************************************************************************
+|* SwClient::Modify()
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+void SwClient::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+{
+ if( (!pOld || pOld->Which() != RES_OBJECTDYING) )
+ return;
+
+ SwPtrMsgPoolItem *pDead = (SwPtrMsgPoolItem *)pOld;
+ if(pDead->pObject == pRegisteredIn)
+ {
+ SwModify *pAbove = (SwModify*)pRegisteredIn->GetRegisteredIn();
+ if(pAbove)
+ {
+ pAbove->Add(this);
+ return;
+ }
+ pRegisteredIn->Remove(this);
+ }
+}
+
+/*************************************************************************
+|* SwClient::~SwClient()
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung MA 25. Jan. 94
+*************************************************************************/
+
+
+SwClient::~SwClient()
+{
+ if( pRegisteredIn && pRegisteredIn->GetDepends() )
+ pRegisteredIn->Remove( this );
+
+ ASSERT( !IsModifyLocked(), "Modify destroyed but locked." );
+}
+
+
+ // erfrage vom Client Informationen
+BOOL SwClient::GetInfo( SfxPoolItem& ) const
+{
+ return TRUE; // und weiter
+}
+
+/*************************************************************************
+|* SwModify::SwModify( SwModify * )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+SwModify::SwModify( SwModify *pToRegisterIn )
+ : SwClient(pToRegisterIn), pRoot( 0 )
+{
+}
+
+/*************************************************************************
+|* SwModify::~SwModify()
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 15.04.94
+*************************************************************************/
+
+
+
+SwModify::~SwModify()
+{
+ if ( IsInCache() )
+ SwFrm::GetCache().Delete( this );
+
+ if ( IsInSwFntCache() )
+ pSwFontCache->Delete( this );
+
+ if( pRoot )
+ {
+ if( IsInDocDTOR() )
+ {
+ // alle Clients "logisch" austragen
+ SwClientIter aIter( *this );
+ SwClient* p;
+ while( 0 != ( p = aIter++ ) )
+ p->pRegisteredIn = 0;
+
+ p = aIter.GoRoot(); // wieder ab Root (==Start) anfangen
+ do {
+ p->pRegisteredIn = 0;
+ } while( 0 != ( p = aIter-- ) );
+ }
+ else
+ {
+ // verschicke die Nachricht an die abgeleiteten Objekte.
+ SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
+ Modify( &aDyObject, &aDyObject );
+
+ // Zwangsummeldung aller derjenigen, die sich nicht ausgetragen
+ // haben, durch Aufruf von SwClient::Modify()
+ while( pRoot )
+ pRoot->SwClient::Modify(&aDyObject, &aDyObject);
+ }
+ }
+}
+
+/*************************************************************************
+|* SwModify::Modify( SwHint * pOldValue, SwHint * pNewValue )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung MA 20. Mar. 95
+*************************************************************************/
+
+
+
+void SwModify::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+{
+
+ if( !pRoot || IsModifyLocked() )
+ return;
+
+
+ if ( IsInCache() || IsInSwFntCache() )
+ {
+ const USHORT nWhich = pOldValue ? pOldValue->Which() :
+ pNewValue ? pNewValue->Which() : 0;
+ CheckCaching( nWhich );
+ }
+
+ LockModify();
+
+ bInModify =
+#ifdef PRODUCT
+ TRUE
+#else
+ // Modifies von RES_OBJECTDYING sollte kein ASSRT ausloesen
+ !pOldValue ||
+ (RES_OBJECTDYING != pOldValue->Which() &&
+ RES_REMOVE_UNO_OBJECT != pOldValue->Which()) ||
+ ((SwPtrMsgPoolItem *)pOldValue)->pObject != this
+#endif
+ ;
+
+ SwClientIter aIter( *this );
+ SwClient * pLast = aIter.GoStart();
+ if( pLast ) // konnte zum Anfang gesprungen werden ??
+ do {
+ pLast->Modify( pOldValue, pNewValue );
+ if( !pRoot ) // Baum schon Weg ??
+ break;
+ } while( 0 != ( pLast = aIter++ ));
+
+ bInModify = FALSE;
+ UnlockModify();
+}
+
+// erfrage vom Modify Informationen
+
+BOOL SwModify::GetInfo( SfxPoolItem& rInfo ) const
+{
+ BOOL bRet = TRUE; // bedeutet weiter zum naechsten
+
+ if( pRoot )
+ {
+ SwClientIter aIter( *(SwModify*)this );
+
+ SwClient* pLast = aIter.GoStart();
+ if( pLast )
+ while( 0 != ( bRet = pLast->GetInfo( rInfo )) &&
+ 0 != ( pLast = aIter++ ) )
+ ;
+ }
+
+ return bRet; // und weiter
+}
+
+/*************************************************************************
+|* SwModify::Add( SwClient *pDepend )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 14.09.94
+*************************************************************************/
+
+
+
+void SwModify::Add(SwClient *pDepend)
+{
+ ASSERT( !bInModify, "Client innerhalb des eigenen Modifies einfuegen?" );
+
+ // nur wenn das hier noch nicht eingetragen ist einfuegen
+ if(pDepend->pRegisteredIn != this )
+ {
+#ifndef PRODUCT
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp )
+ {
+ ASSERT( &pTmp->rRoot != pRoot,
+ "Client beim angemeldeten ClientIter einfuegen?" );
+ pTmp = pTmp->pNxtIter;
+ }
+#endif
+ // wenn schon wanders angemeldet, dann dort abmelden
+ if( pDepend->pRegisteredIn != 0 )
+ pDepend->pRegisteredIn->Remove( pDepend );
+
+ if( !pRoot )
+ {
+ pRoot = pDepend;
+ pRoot->pLeft = 0;
+ pRoot->pRight = 0;
+ }
+ else
+ {
+ // immer hinter die Root haengen
+ pDepend->pRight = pRoot->pRight;
+ pRoot->pRight = pDepend;
+ pDepend->pLeft = pRoot;
+ if( pDepend->pRight )
+ pDepend->pRight->pLeft = pDepend;
+ }
+
+ pDepend->pRegisteredIn = this;
+ }
+
+}
+
+/*************************************************************************
+|* SwModify::_Remove( SwClient *pDepend )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 14.09.94
+*************************************************************************/
+
+
+
+SwClient *SwModify::_Remove(SwClient * pDepend)
+{
+ ASSERT( !bInModify, "Client innerhalb des eigenen Modifies loeschen?" );
+
+ // loesche das Object aus der Liste und setze den
+ // Registrierungs-Pointer zurueck
+ if( pDepend->pRegisteredIn == this )
+ {
+ register SwClient* pR = pDepend->pRight;
+ register SwClient* pL = pDepend->pLeft;
+ if( pRoot == pDepend )
+ pRoot = pL ? pL : pR;
+
+ if( pL )
+ pL->pRight = pR;
+ if( pR )
+ pR->pLeft = pL;
+
+ // alle Client-Iters updaten
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp )
+ {
+ if( pTmp->pAkt == pDepend || pTmp->pDelNext == pDepend )
+ pTmp->pDelNext = pR;
+ pTmp = pTmp->pNxtIter;
+ }
+
+ pDepend->pLeft = 0;
+ pDepend->pRight = 0;
+ }
+ else
+ ASSERT( FALSE, "SwModify::Remove(): pDepend nicht gefunden");
+ pDepend->pRegisteredIn = 0;
+ return pDepend;
+}
+
+
+/*************************************************************************
+|* SwModify::CheckCaching( const USHORT nWhich )
+|*
+|* Ersterstellung JP 25.06.95
+|* Letzte Aenderung JP 25.06.95
+*************************************************************************/
+
+
+
+void SwModify::CheckCaching( const USHORT nWhich )
+{
+ if( RES_CHRATR_BEGIN <= nWhich && RES_CHRATR_END > nWhich )
+ SetInSwFntCache( FALSE );
+ else
+ switch ( nWhich )
+ {
+ case RES_OBJECTDYING:
+ case RES_FMT_CHG:
+ case RES_ATTRSET_CHG:
+ SetInSwFntCache( FALSE );
+
+ case RES_UL_SPACE:
+ case RES_LR_SPACE:
+ case RES_BOX:
+ case RES_SHADOW:
+ case RES_FRM_SIZE:
+ case RES_KEEP:
+ case RES_BREAK:
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ break;
+ }
+}
+
+
+// ----------
+// SwDepend
+// ----------
+
+/*************************************************************************
+|* SwDepend::SwDepend(SwClient *pTellHim,SwModify *pDepend)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+SwDepend::SwDepend(SwClient *pTellHim, SwModify *pDepend)
+ : SwClient(pDepend)
+{
+ pToTell = pTellHim;
+}
+
+/*************************************************************************
+|*
+|* SwDepend::Modify(SwHint *, SwHint *)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+|*
+*************************************************************************/
+
+
+void SwDepend::Modify( SfxPoolItem *pOldValue, SfxPoolItem *pNewValue )
+{
+ if(pNewValue && pNewValue->Which() == RES_OBJECTDYING)
+ SwClient::Modify(pOldValue,pNewValue);
+ else if(pToTell)
+ pToTell->Modify(pOldValue, pNewValue);
+}
+
+
+ // erfrage vom Modify Informationen
+BOOL SwDepend::GetInfo( SfxPoolItem& rInfo ) const
+{
+ return pToTell ? pToTell->GetInfo( rInfo ) : TRUE;
+}
+
+/********************************************************************/
+
+
+SwClientIter::SwClientIter( SwModify& rModify )
+ : rRoot( rModify )
+{
+ // hinten einketten!
+ pNxtIter = 0;
+ if( pClientIters )
+ {
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp->pNxtIter )
+ pTmp = pTmp->pNxtIter;
+ pTmp->pNxtIter = this;
+ }
+ else
+ pClientIters = this;
+
+ pAkt = rRoot.pRoot;
+ pDelNext = pAkt;
+}
+
+
+
+SwClientIter::~SwClientIter()
+{
+ if( pClientIters )
+ {
+ if( pClientIters == this )
+ pClientIters = pNxtIter;
+ else
+ {
+ SwClientIter* pTmp = pClientIters;
+ while( pTmp->pNxtIter != this )
+ if( 0 == ( pTmp = pTmp->pNxtIter ) )
+ {
+ ASSERT( this, "wo ist mein Pointer" );
+ return ;
+ }
+ pTmp->pNxtIter = pNxtIter;
+ }
+ }
+}
+
+
+#ifndef CFRONT
+ // Postfix Operator
+SwClient* SwClientIter::operator++(int)
+{
+// solange der CFRONT Prefix und PostFix nicht unterscheiden kann, immer
+// als Prefix-Operator arbeiten. Wenn der CFRONT es kann, muss auch der
+// Code entsprechen umgestellt werden !!!
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+ return pAkt;
+}
+#endif
+
+
+ // Prefix Operator
+SwClient* SwClientIter::operator++()
+{
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+ return pAkt;
+}
+
+
+#ifndef CFRONT
+ // Postfix Operator
+SwClient* SwClientIter::operator--(int)
+{
+// solange der CFRONT Prefix und PostFix nicht unterscheiden kann, immer
+// als Prefix-Operator arbeiten. Wenn der CFRONT es kann, muss auch der
+// Code entsprechen umgestellt werden !!!
+ if( pDelNext == pAkt )
+ pAkt = pAkt->pLeft;
+ else
+ pAkt = pDelNext->pLeft;
+ pDelNext = pAkt;
+ return pAkt;
+}
+#endif
+
+
+ // Prefix Operator
+SwClient* SwClientIter::operator--()
+{
+ if( pDelNext == pAkt )
+ pAkt = pAkt->pLeft;
+ else
+ pAkt = pDelNext->pLeft;
+ pDelNext = pAkt;
+ return pAkt;
+}
+
+
+SwClient* SwClientIter::GoStart() // zum Anfang des Baums
+{
+ pAkt = rRoot.pRoot;
+ if( pAkt )
+ while( pAkt->pLeft )
+ pAkt = pAkt->pLeft;
+ pDelNext = pAkt;
+ return pAkt;
+}
+
+
+SwClient* SwClientIter::GoEnd() // zum End des Baums
+{
+ pAkt = pDelNext;
+ if( !pAkt )
+ pAkt = rRoot.pRoot;
+ if( pAkt )
+ while( pAkt->pRight )
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ return pAkt;
+}
+
+
+
+SwClient* SwClientIter::First( TypeId nType )
+{
+ aSrchId = nType;
+ GoStart();
+ if( pAkt )
+ do {
+ if( pAkt->IsA( aSrchId ) )
+ break;
+
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+
+ } while( pAkt );
+ return pAkt;
+}
+
+
+SwClient* SwClientIter::Next()
+{
+ do {
+ // erstmal zum naechsten
+ if( pDelNext == pAkt )
+ {
+ pAkt = pAkt->pRight;
+ pDelNext = pAkt;
+ }
+ else
+ pAkt = pDelNext;
+
+ if( pAkt && pAkt->IsA( aSrchId ) )
+ break;
+ } while( pAkt );
+ return pAkt;
+}
+
+
+
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
new file mode 100644
index 000000000000..7fd9751247f7
--- /dev/null
+++ b/sw/source/core/attr/cellatr.cxx
@@ -0,0 +1,318 @@
+/*************************************************************************
+ *
+ * $RCSfile: cellatr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include
+#ifndef _HINTIDS_HXX
+#include // fuer RES_..
+#endif
+
+#ifndef _CELLATR_HXX
+#include
+#endif
+#ifndef _CALC_HXX
+#include
+#endif
+#ifndef _FORMAT_HXX
+#include
+#endif
+#ifndef _DOC_HXX
+#include
+#endif
+#ifndef _SWTABLE_HXX
+#include
+#endif
+#ifndef _NODE_HXX
+#include
+#endif
+#ifndef _HINTS_HXX
+#include
+#endif
+#ifndef _ROLBCK_HXX
+#include
+#endif
+
+
+
+//TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+SwTblBoxNumFormat::SwTblBoxNumFormat( UINT32 nFormat, BOOL bFlag )
+ : SfxUInt32Item( RES_BOXATR_FORMAT, nFormat ), bAuto( bFlag )
+{
+}
+
+
+int SwTblBoxNumFormat::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return GetValue() == ((SwTblBoxNumFormat&)rAttr).GetValue() &&
+ bAuto == ((SwTblBoxNumFormat&)rAttr).bAuto;
+}
+
+
+SfxPoolItem* SwTblBoxNumFormat::Clone( SfxItemPool* ) const
+{
+ return new SwTblBoxNumFormat( GetValue(), bAuto );
+}
+
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+
+SwTblBoxFormula::SwTblBoxFormula( const String& rFormula )
+ : SfxPoolItem( RES_BOXATR_FORMULA ),
+ SwTableFormula( rFormula ),
+ pDefinedIn( 0 )
+{
+}
+
+
+int SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return GetFormula() == ((SwTblBoxFormula&)rAttr).GetFormula() &&
+ pDefinedIn == ((SwTblBoxFormula&)rAttr).pDefinedIn;
+}
+
+
+SfxPoolItem* SwTblBoxFormula::Clone( SfxItemPool* ) const
+{
+// auf externe Darstellung umschalten!!
+ SwTblBoxFormula* pNew = new SwTblBoxFormula( GetFormula() );
+ pNew->SwTableFormula::operator=( *this );
+ return pNew;
+}
+
+
+
+ // suche den Node, in dem die Formel steht:
+ // TextFeld -> TextNode,
+ // BoxAttribut -> BoxStartNode
+ // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
+const SwNode* SwTblBoxFormula::GetNodeOfFormula() const
+{
+ const SwNode* pRet = 0;
+ if( pDefinedIn )
+ {
+ SwClient* pBox = SwClientIter( *pDefinedIn ).First( TYPE( SwTableBox ));
+ if( pBox )
+ pRet = ((SwTableBox*)pBox)->GetSttNd();
+ }
+ return pRet;
+}
+
+
+SwTableBox* SwTblBoxFormula::GetTableBox()
+{
+ SwTableBox* pBox = 0;
+ if( pDefinedIn )
+ pBox = (SwTableBox*)SwClientIter( *pDefinedIn ).
+ First( TYPE( SwTableBox ));
+ return pBox;
+}
+
+
+void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem )
+{
+ if( !pDefinedIn )
+ return ;
+
+ SwTableFmlUpdate* pUpdtFld;
+ if( !pItem || RES_TABLEFML_UPDATE != pItem->Which() )
+ {
+ // setze bei allen das Value-Flag zurueck
+ ChgValid( FALSE );
+ return ;
+ }
+
+ pUpdtFld = (SwTableFmlUpdate*)pItem;
+
+ // bestimme die Tabelle, in der das Attribut steht
+ const SwTableNode* pTblNd;
+ const SwNode* pNd = GetNodeOfFormula();
+ if( pNd && &pNd->GetNodes() == &pNd->GetDoc()->GetNodes() &&
+ 0 != ( pTblNd = pNd->FindTableNode() ))
+ {
+ switch( pUpdtFld->eFlags )
+ {
+ case TBL_CALC:
+ // setze das Value-Flag zurueck
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+// if( VF_CMD & pFld->GetFormat() )
+// pFld->PtrToBoxNm( pUpdtFld->pTbl );
+// else
+ ChgValid( FALSE );
+ break;
+ case TBL_BOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur externen Darstellung
+ PtrToBoxNm( pUpdtFld->pTbl );
+ break;
+ case TBL_BOXPTR:
+ // zur internen Darstellung
+ // JP 17.06.96: interne Darstellung auf alle Formeln
+ // (Referenzen auf andere Tabellen!!!)
+ BoxNmToPtr( &pTblNd->GetTable() );
+ break;
+ case TBL_RELBOXNAME:
+ // ist es die gesuchte Tabelle ??
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ // zur relativen Darstellung
+ ToRelBoxNm( pUpdtFld->pTbl );
+ break;
+
+ case TBL_SPLITTBL:
+ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+ {
+ USHORT nLnPos = SwTableFormula::GetLnPosInTbl(
+ pTblNd->GetTable(), GetTableBox() );
+ pUpdtFld->bBehindSplitLine = USHRT_MAX != nLnPos &&
+ pUpdtFld->nSplitLine <= nLnPos;
+ }
+ else
+ pUpdtFld->bBehindSplitLine = FALSE;
+ // kein break
+ case TBL_MERGETBL:
+ if( pUpdtFld->pHistory )
+ {
+ // fuer die History brauche ich aber die unveraenderte Formel
+ SwTblBoxFormula aCopy( *this );
+ pUpdtFld->bModified = FALSE;
+ ToSplitMergeBoxNm( *pUpdtFld );
+
+ if( pUpdtFld->bModified )
+ {
+ // und dann in der externen Darstellung
+ aCopy.PtrToBoxNm( &pTblNd->GetTable() );
+ pUpdtFld->pHistory->Add( &aCopy, &aCopy,
+ pNd->FindTableBoxStartNode()->GetIndex() );
+ }
+ }
+ else
+ ToSplitMergeBoxNm( *pUpdtFld );
+ break;
+ }
+ }
+}
+
+
+void SwTblBoxFormula::Calc( SwTblCalcPara& rCalcPara, double& rValue )
+{
+ if( !rCalcPara.rCalc.IsCalcError() ) // ist schon Fehler gesetzt ?
+ {
+ // erzeuge aus den BoxNamen die Pointer
+ BoxNmToPtr( rCalcPara.pTbl );
+ String sFml( MakeFormel( rCalcPara ));
+ if( !rCalcPara.rCalc.IsCalcError() )
+ rValue = rCalcPara.rCalc.Calculate( sFml ).GetDouble();
+ else
+ rValue = DBL_MAX;
+ ChgValid( !rCalcPara.IsStackOverFlow() ); // der Wert ist wieder gueltig
+ }
+}
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+SwTblBoxValue::SwTblBoxValue()
+ : SfxPoolItem( RES_BOXATR_VALUE ), nValue( 0 )
+{
+}
+
+
+SwTblBoxValue::SwTblBoxValue( const double nVal )
+ : SfxPoolItem( RES_BOXATR_VALUE ), nValue( nVal )
+{
+}
+
+
+int SwTblBoxValue::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return nValue == ((SwTblBoxValue&)rAttr).nValue;
+}
+
+
+SfxPoolItem* SwTblBoxValue::Clone( SfxItemPool* ) const
+{
+ return new SwTblBoxValue( nValue );
+}
+
+
+
+
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
new file mode 100644
index 000000000000..336ae85ded36
--- /dev/null
+++ b/sw/source/core/attr/format.cxx
@@ -0,0 +1,677 @@
+/*************************************************************************
+ *
+ * $RCSfile: format.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _HINTIDS_HXX
+#include // fuer RES_..
+#endif
+#ifndef _FRAME_HXX
+#include // fuer AttrCache
+#endif
+#ifndef _FORMAT_HXX
+#include
+#endif
+
+#ifndef _HINTS_HXX
+#include // fuer SwFmtChg
+#endif
+#ifndef _PARATR_HXX
+#include // fuer SwParaFmt - SwHyphenBug
+#endif
+#ifndef _SWCACHE_HXX
+#include
+#endif
+
+
+TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|* SwFmt::SwFmt
+*************************************************************************/
+
+
+SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+ const USHORT* pWhichRanges, SwFmt *pDrvdFrm, USHORT nFmtWhich )
+ : SwModify( pDrvdFrm ),
+ aSet( rPool, pWhichRanges ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX ),
+ nFmtId( 0 ),
+ nWhichId( nFmtWhich )
+{
+ aFmtName.AssignAscii( pFmtNm );
+ bWritten = bFmtInDTOR = bAutoUpdateFmt = bLayerFmt = FALSE; // LAYER_IMPL
+ bAutoFmt = TRUE;
+
+ if( pDrvdFrm )
+ aSet.SetParent( &pDrvdFrm->aSet );
+}
+
+
+SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
+ const USHORT* pWhichRanges, SwFmt *pDrvdFrm, USHORT nFmtWhich )
+ : SwModify( pDrvdFrm ),
+ aFmtName( rFmtNm ),
+ aSet( rPool, pWhichRanges ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX ),
+ nFmtId( 0 ),
+ nWhichId( nFmtWhich )
+{
+ bWritten = bFmtInDTOR = bAutoUpdateFmt = bLayerFmt = FALSE; // LAYER_IMPL
+ bAutoFmt = TRUE;
+
+ if( pDrvdFrm )
+ aSet.SetParent( &pDrvdFrm->aSet );
+}
+
+
+SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm, USHORT nWhich1,
+ USHORT nWhich2, SwFmt *pDrvdFrm, USHORT nFmtWhich )
+ : SwModify( pDrvdFrm ),
+ aFmtName( rFmtNm ),
+ aSet( rPool, nWhich1, nWhich2 ),
+ nPoolFmtId( USHRT_MAX ),
+ nPoolHelpId( USHRT_MAX ),
+ nPoolHlpFileId( UCHAR_MAX ),
+ nFmtId( 0 ),
+ nWhichId( nFmtWhich )
+{
+ bWritten = bFmtInDTOR = bAutoUpdateFmt = bLayerFmt = FALSE; // LAYER_IMPL
+ bAutoFmt = TRUE;
+ if( pDrvdFrm )
+ aSet.SetParent( &pDrvdFrm->aSet );
+}
+
+
+SwFmt::SwFmt( const SwFmt& rFmt )
+ : SwModify( rFmt.DerivedFrom() ),
+ aFmtName( rFmt.aFmtName ),
+ aSet( rFmt.aSet ),
+ nPoolFmtId( rFmt.GetPoolFmtId() ),
+ nPoolHelpId( rFmt.GetPoolHelpId() ),
+ nPoolHlpFileId( rFmt.GetPoolHlpFileId() ),
+ nFmtId( 0 ),
+ nWhichId( rFmt.nWhichId )
+{
+ bWritten = bFmtInDTOR = bLayerFmt = FALSE; // LAYER_IMPL
+ bAutoFmt = rFmt.bAutoFmt;
+ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+
+ if( rFmt.DerivedFrom() )
+ aSet.SetParent( &rFmt.DerivedFrom()->aSet );
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+}
+
+/*************************************************************************
+|* SwFmt &SwFmt::operator=(const SwFmt& aFmt)
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+SwFmt &SwFmt::operator=(const SwFmt& rFmt)
+{
+ nWhichId = rFmt.nWhichId;
+ nPoolFmtId = rFmt.GetPoolFmtId();
+ nPoolHelpId = rFmt.GetPoolHelpId();
+ nPoolHlpFileId = rFmt.GetPoolHlpFileId();
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // kopiere nur das Attribut-Delta Array
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
+ aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
+
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ // PoolItem-Attr erzeugen fuers Modify !!!
+ if( aOld.Count() )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+
+ if( pRegisteredIn != rFmt.pRegisteredIn )
+ {
+ if( pRegisteredIn )
+ pRegisteredIn->Remove(this);
+ if(rFmt.pRegisteredIn)
+ {
+ rFmt.pRegisteredIn->Add(this);
+ aSet.SetParent( &rFmt.aSet );
+ }
+ else
+ aSet.SetParent( 0 );
+ }
+ bAutoFmt = rFmt.bAutoFmt;
+ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+ return *this;
+}
+
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * diese Funktion wird in jedem Copy-Ctor gerufen, damit die
+ * Attribute kopiert werden. Diese koennen erst kopiert werden,
+ * wenn die abgeleitet Klasse existiert, denn beim Setzen der
+ * Attribute wird die Which()-Methode gerufen, die hier in der
+ * Basis-Klasse auf 0 defaultet ist.
+ *
+ * Zusatz: JP 8.4.1994
+ * Wird ueber Dokumentgrenzen kopiert, so muss das neue Dokument
+ * mit angeben werden, in dem this steht. Z.Z. ist das fuers
+ * DropCaps wichtig, dieses haelt Daten, die tief kopiert werden
+ * muessen !!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
+void SwFmt::CopyAttrs( const SwFmt& rFmt, BOOL bReplace )
+{
+ // kopiere nur das Attribut-Delta Array
+ register SwCharFmt* pDropCharFmt = 0;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // Sonderbehandlung fuer einige Attribute
+ SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
+
+ if( !bReplace ) // nur die neu, die nicht gesetzt sind ??
+ {
+ if( pChgSet == (SwAttrSet*)&rFmt.aSet ) // Set hier kopieren
+ pChgSet = new SwAttrSet( rFmt.aSet );
+ pChgSet->Differentiate( aSet );
+ }
+
+ // kopiere nur das Attribut-Delta Array
+ if( pChgSet->GetPool() != aSet.GetPool() )
+ pChgSet->CopyToModify( *this );
+ else
+ {
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+
+ if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+
+ if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // Set hier angelegt ?
+ delete pChgSet;
+}
+
+/*************************************************************************
+|* SwFmt::~SwFmt()
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 14.02.91
+*************************************************************************/
+
+
+SwFmt::~SwFmt()
+{
+ /* das passiert bei der ObjectDying Message */
+ /* alle Abhaengigen auf DerivedFrom umhaengen */
+ if( GetDepends() )
+ {
+ ASSERT(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" );
+
+ bFmtInDTOR = TRUE;
+
+ SwFmt *pParentFmt = DerivedFrom();
+ while( GetDepends() )
+ {
+ SwFmtChg aOldFmt(this);
+ SwFmtChg aNewFmt(pParentFmt);
+ SwClient * pDepend = (SwClient*)GetDepends();
+ pParentFmt->Add(pDepend);
+ pDepend->Modify(&aOldFmt, &aNewFmt);
+ }
+ }
+}
+
+
+/*************************************************************************
+|* void SwFmt::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+void SwFmt::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+{
+ BOOL bWeiter = TRUE; // TRUE = Propagierung an die Abhaengigen
+
+ USHORT nWhich = pOldValue ? pOldValue->Which() :
+ pNewValue ? pNewValue->Which() : 0 ;
+ switch( nWhich )
+ {
+ case 0: break; // Which-Id von 0 ???
+
+ case RES_OBJECTDYING :
+ {
+ // ist das sterbende Object das "Parent"-Format von diesen Format,
+ // dann haengt sich dieses Format an den Parent vom Parent
+ SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
+
+ // nicht umhaengen wenn dieses das oberste Format ist !!
+ if( pRegisteredIn && pRegisteredIn == pFmt )
+ {
+ if( pFmt->pRegisteredIn )
+ {
+ // wenn Parent, dann im neuen Parent wieder anmelden
+ pFmt->DerivedFrom()->Add( this );
+ aSet.SetParent( &DerivedFrom()->aSet );
+ }
+ else
+ {
+ // sonst auf jeden Fall beim sterbenden abmelden
+ DerivedFrom()->Remove( this );
+ aSet.SetParent( 0 );
+ }
+ }
+ } // OBJECTDYING
+ break;
+
+ case RES_ATTRSET_CHG:
+ if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
+ {
+ //nur die weiter geben, die hier nicht gesetzt sind !!
+ SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
+ SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
+
+ aOld.GetChgSet()->Differentiate( aSet );
+ aNew.GetChgSet()->Differentiate( aSet );
+
+ if( aNew.Count() )
+ // keine mehr gesetzt, dann Ende !!
+ SwModify::Modify( &aOld, &aNew );
+ bWeiter = FALSE;
+ }
+ break;
+ case RES_FMT_CHG:
+ // falls mein Format Parent umgesetzt wird, dann melde ich
+ // meinen Attrset beim Neuen an.
+
+ // sein eigenes Modify ueberspringen !!
+ if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
+ ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
+ {
+ // den Set an den neuen Parent haengen
+ aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
+ }
+ break;
+
+ case RES_RESET_FMTWRITTEN:
+ {
+ // IsWritten-Flag zuruecksetzen. Hint nur an abhanegige
+ // Formate (und keine Frames) propagieren.
+ ResetWritten();
+ SwClientIter aIter( *this );
+ for( SwClient *pClient = aIter.First( TYPE(SwFmt) ); pClient;
+ pClient = aIter.Next() )
+ pClient->Modify( pOldValue, pNewValue );
+
+ bWeiter = FALSE;
+ }
+ break;
+
+ default:
+ {
+ // Ist das Attribut in diesem Format definiert, dann auf
+ // NICHT weiter propagieren !!
+ if( SFX_ITEM_SET == aSet.GetItemState( nWhich, FALSE ))
+ {
+// wie finde ich heraus, ob nicht ich die Message versende ??
+// aber wer ruft das hier ????
+//ASSERT( FALSE, "Modify ohne Absender verschickt" );
+//JP 11.06.96: DropCaps koennen hierher kommen
+ASSERT( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" );
+ bWeiter = FALSE;
+ }
+
+ } // default
+ } // switch
+
+ if( bWeiter )
+ {
+ // laufe durch alle abhaengigen Formate
+ SwModify::Modify( pOldValue, pNewValue );
+ }
+
+}
+
+
+BOOL SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
+{
+ if ( pDerFrom )
+ {
+ // Zyklus?
+ const SwFmt* pFmt = pDerFrom;
+ while ( pFmt != 0 )
+ {
+ if ( pFmt == this )
+ return FALSE;
+
+ pFmt=pFmt->DerivedFrom();
+ }
+ }
+ else
+ {
+ // Nichts angegeben, Dflt-Format suchen
+ pDerFrom = this;
+ while ( pDerFrom->DerivedFrom() )
+ pDerFrom = pDerFrom->DerivedFrom();
+ }
+ if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
+ return FALSE;
+
+ ASSERT( Which()==pDerFrom->Which()
+ || ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
+ || ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
+ || ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
+ "SetDerivedFrom: Aepfel von Birnen ableiten?");
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ pDerFrom->Add(this);
+ aSet.SetParent( &pDerFrom->aSet );
+
+ SwFmtChg aOldFmt(this);
+ SwFmtChg aNewFmt(this);
+ Modify( &aOldFmt, &aNewFmt );
+
+ return TRUE;
+}
+
+
+BOOL SwFmt::SetAttr(const SfxPoolItem& rAttr )
+{
+ if ( IsInCache() || IsInSwFntCache() )
+ {
+ const USHORT nWhich = rAttr.Which();
+ CheckCaching( nWhich );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+ // fuer FrmFmt's immer das Modify verschicken!
+ BOOL bRet = FALSE;
+ USHORT nFmtWhich;
+ if( IsModifyLocked() || (!GetDepends() &&
+ (RES_GRFFMTCOLL == (nFmtWhich = Which()) ||
+ RES_TXTFMTCOLL == nFmtWhich ) ) )
+ {
+ if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
+ aSet.SetModifyAtAttr( this );
+ }
+ else
+ {
+ // kopiere nur das Attribut-Delta Array
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+
+ if( 0 != (bRet = aSet.Put_BC( rAttr, &aOld, &aNew )))
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+
+
+BOOL SwFmt::SetAttr( const SfxItemSet& rSet )
+{
+ if( !rSet.Count() )
+ return FALSE;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+ // fuer FrmFmt's immer das Modify verschicken!
+ BOOL bRet = FALSE;
+ USHORT nFmtWhich;
+ if( IsModifyLocked() || (!GetDepends() &&
+ (RES_GRFFMTCOLL == (nFmtWhich = Which()) ||
+ RES_TXTFMTCOLL == nFmtWhich ) ) )
+ {
+ if( 0 != ( bRet = (0 != aSet.Put( rSet ))) )
+ aSet.SetModifyAtAttr( this );
+ }
+ else
+ {
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ if( 0 != ( bRet = aSet.Put_BC( rSet, &aOld, &aNew ) ) )
+ {
+ // einige Sonderbehandlungen fuer Attribute
+ aSet.SetModifyAtAttr( this );
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ }
+ return bRet;
+}
+
+// Nimmt den Hint mit nWhich aus dem Delta-Array
+
+
+BOOL SwFmt::ResetAttr( USHORT nWhich1, USHORT nWhich2 )
+{
+ if( !aSet.Count() )
+ return FALSE;
+
+ if( !nWhich2 || nWhich2 < nWhich1 )
+ nWhich2 = nWhich1; // dann setze auf 1. Id, nur dieses Item
+
+ if ( IsInCache() || IsInSwFntCache() )
+ {
+ for( USHORT n = nWhich1; n < nWhich2; ++n )
+ CheckCaching( n );
+ }
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ return 0 != (( nWhich2 == nWhich1 )
+ ? aSet.ClearItem( nWhich1 )
+ : aSet.ClearItem_BC( nWhich1, nWhich2 ));
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ BOOL bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ return bRet;
+}
+
+
+
+USHORT SwFmt::ResetAllAttr()
+{
+ if( !aSet.Count() )
+ return 0;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ return aSet.ClearItem( 0 );
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ BOOL bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+ return aNew.Count();
+}
+
+
+/*************************************************************************
+|* void SwFmt::GetInfo( const SfxPoolItem& ) const
+|*
+|* Beschreibung
+|* Ersterstellung JP 18.04.94
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+BOOL SwFmt::GetInfo( SfxPoolItem& rInfo ) const
+{
+ BOOL bRet = SwModify::GetInfo( rInfo );
+ return bRet;
+}
+
+
+void SwFmt::DelDiffs( const SfxItemSet& rSet )
+{
+ if( !aSet.Count() )
+ return;
+
+ if ( IsInCache() )
+ {
+ SwFrm::GetCache().Delete( this );
+ SetInCache( FALSE );
+ }
+ SetInSwFntCache( FALSE );
+
+ // wenn Modify gelockt ist, werden keine Modifies verschickt
+ if( IsModifyLocked() )
+ {
+ aSet.Intersect( rSet );
+ return;
+ }
+
+ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+ aNew( *aSet.GetPool(), aSet.GetRanges() );
+ BOOL bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
+
+ if( bRet )
+ {
+ SwAttrSetChg aChgOld( aSet, aOld );
+ SwAttrSetChg aChgNew( aSet, aNew );
+ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+ }
+}
+
+
+
+
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
new file mode 100644
index 000000000000..9f1ecc4e04cd
--- /dev/null
+++ b/sw/source/core/attr/hints.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * $RCSfile: hints.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+
+#ifndef _HINTIDS_HXX
+#include
+#endif
+#ifndef _SWTYPES_HXX
+#include
+#endif
+#ifndef _NDTXT_HXX
+#include
+#endif
+#ifndef _ERRHDL_HXX
+#include
+#endif
+#ifndef _HINTS_HXX
+#include
+#endif
+#ifndef _SWERROR_H
+#include
+#endif
+
+
+
+SwFmtChg::SwFmtChg( SwFmt *pFmt )
+ : SwMsgPoolItem( RES_FMT_CHG ),
+ pChangedFmt( pFmt )
+{}
+
+
+SwInsChr::SwInsChr( xub_StrLen nP )
+ : SwMsgPoolItem( RES_INS_CHR ),
+ nPos( nP )
+{}
+
+
+
+SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL )
+ : SwMsgPoolItem( RES_INS_TXT ),
+ nPos( nP ),
+ nLen( nL )
+{}
+
+
+
+SwDelChr::SwDelChr( xub_StrLen nP )
+ : SwMsgPoolItem( RES_DEL_CHR ),
+ nPos( nP )
+{}
+
+
+
+SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )
+ : SwMsgPoolItem( RES_DEL_TXT ),
+ nStart( nS ),
+ nLen( nL )
+{}
+
+
+
+SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, USHORT nW )
+ : SwMsgPoolItem( RES_UPDATE_ATTR ),
+ nStart( nS ),
+ nEnd( nE ),
+ nWhichAttr( nW )
+{}
+
+
+// SwRefMarkFldUpdate wird verschickt, wenn sich die ReferenzMarkierungen
+// Updaten sollen. Um Seiten-/KapitelNummer feststellen zu koennen, muss
+// der akt. Frame befragt werden. Dafuer wird das akt. OutputDevice benoetigt.
+
+
+SwRefMarkFldUpdate::SwRefMarkFldUpdate( const OutputDevice* pOutput )
+ : SwMsgPoolItem( RES_REFMARKFLD_UPDATE ),
+ pOut( pOutput )
+{
+ ASSERT( pOut, "es muss ein OutputDevice-Pointer gesetzt werden!" );
+}
+
+
+SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDocPos )
+ : SwMsgPoolItem( RES_DOCPOS_UPDATE ),
+ nDocPos(nDocPos)
+{}
+
+
+
+// SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll
+SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
+ : SwMsgPoolItem( RES_TABLEFML_UPDATE ),
+ pTbl( pNewTbl ), pHistory( 0 ), eFlags( TBL_CALC ),
+ nSplitLine( USHRT_MAX )
+{
+ DATA.pDelTbl = 0;
+ bModified = bBehindSplitLine = FALSE;
+ ASSERT( pTbl, "es muss ein Table-Pointer gesetzt werden!" );
+}
+
+
+SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
+ : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ),
+ pCntntNode( 0 ), pNodes( pNds )
+{}
+
+
+SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
+ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+ pTheChgdSet( &rTheSet ),
+ pChgSet( &rSet ),
+ bDelSet( FALSE )
+{}
+
+
+SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
+ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+ pTheChgdSet( rChgSet.pTheChgdSet ),
+ bDelSet( TRUE )
+{
+ pChgSet = new SwAttrSet( *rChgSet.pChgSet );
+}
+
+
+SwAttrSetChg::~SwAttrSetChg()
+{
+ if( bDelSet )
+ delete pChgSet;
+}
+
+
+#ifndef PRODUCT
+
+void SwAttrSetChg::ClearItem( USHORT nWhich )
+{
+ ASSERT( bDelSet, "der Set darf nicht veraendert werden!" );
+ pChgSet->ClearItem( nWhich );
+}
+
+#endif
+
+
+SwMsgPoolItem::SwMsgPoolItem( USHORT nWhich )
+ : SfxPoolItem( nWhich )
+{}
+
+
+// "Overhead" vom SfxPoolItem
+int SwMsgPoolItem::operator==( const SfxPoolItem& ) const
+{
+ ASSERT( FALSE, "SwMsgPoolItem kennt kein ==" );
+ return 0;
+}
+
+
+SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
+{
+ ASSERT( FALSE, "SwMsgPoolItem kennt kein Clone" );
+ return 0;
+}
+
+/******************************************************************************
+ * hole aus der Default-Attribut Tabelle ueber den Which-Wert
+ * das entsprechende default Attribut.
+ * Ist keines vorhanden, returnt ein 0-Pointer !!!
+ * inline (hintids.hxx) im PRODUCT.
+ ******************************************************************************/
+#ifndef PRODUCT
+
+
+const SfxPoolItem* GetDfltAttr( USHORT nWhich )
+{
+ ASSERT_ID( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN,
+ ERR_OUTOFSCOPE );
+
+ SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
+ ASSERT( pHt, "GetDfltFmtAttr(): Dflt == 0" );
+ return pHt;
+}
+
+#endif
+
+
+
+SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt )
+ : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt )
+{
+}
+
+
+SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) :
+ SwMsgPoolItem( RES_VIRTPAGENUM_INFO ),
+ pPage( 0 ),
+ pOrigPage( pPg ),
+ pFrm( 0 )
+{
+}
+
+SwNumRuleInfo::SwNumRuleInfo( const String& rRuleName )
+ : SwMsgPoolItem( RES_GETNUMNODES ), rName( rRuleName )
+{
+}
+
+void SwNumRuleInfo::AddNode( SwTxtNode& rNd )
+{
+ aList.Insert( rNd.GetIndex(), &rNd );
+}
+
+SwNRuleLowerLevel::SwNRuleLowerLevel( const String& rRuleName, BYTE nSrchLvl )
+ : SwMsgPoolItem( RES_GETLOWERNUMLEVEL ), rName( rRuleName ),
+ nLvl(nSrchLvl)
+{
+}
+
+
+SwFindNearestNode::SwFindNearestNode( const SwNode& rNd )
+ : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 )
+{
+}
+
+void SwFindNearestNode::CheckNode( const SwNode& rNd )
+{
+ if( &pNd->GetNodes() == &rNd.GetNodes() )
+ {
+ ULONG nIdx = rNd.GetIndex();
+ if( nIdx < pNd->GetIndex() &&
+ ( !pFnd || nIdx > pFnd->GetIndex() ) &&
+ nIdx > rNd.GetNodes().GetEndOfExtras().GetIndex() )
+ pFnd = &rNd;
+ }
+}
+
+
+
+
diff --git a/sw/source/core/attr/makefile.mk b/sw/source/core/attr/makefile.mk
new file mode 100644
index 000000000000..b6d3f04314a1
--- /dev/null
+++ b/sw/source/core/attr/makefile.mk
@@ -0,0 +1,101 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-19 00:08:15 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning 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=sw
+TARGET=attr
+
+AUTOSEG=true
+
+PROJECTPCH=core_pch
+PDBTARGET=core_pch
+PROJECTPCHSOURCE=..\core_1st\core_pch
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/sw.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ calbck.cxx \
+ cellatr.cxx \
+ format.cxx \
+ hints.cxx \
+ swatrset.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/calbck.obj \
+ $(SLO)$/cellatr.obj \
+ $(SLO)$/format.obj \
+ $(SLO)$/hints.obj \
+ $(SLO)$/swatrset.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
new file mode 100644
index 000000000000..62c783e17d71
--- /dev/null
+++ b/sw/source/core/attr/swatrset.cxx
@@ -0,0 +1,380 @@
+/*************************************************************************
+ *
+ * $RCSfile: swatrset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include
+
+#ifndef _SVX_COLRITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_BRSHITEM_HXX //autogen
+#include
+#endif
+#define ITEMID_LINE SID_ATTR_LINE_STYLE
+#ifndef _SVX_BOLNITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_BOXITEM_HXX //autogen
+#include
+#endif
+#ifndef _XTABLE_HXX //autogen
+#include
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include
+#endif
+
+#ifndef _FMTPDSC_HXX //autogen
+#include
+#endif
+#ifndef _PAGEDESC_HXX //autogen
+#include
+#endif
+#ifndef _CHARFMT_HXX
+#include
+#endif
+#ifndef _DOC_HXX
+#include
+#endif
+#ifndef _NODE_HXX //autogen
+#include
+#endif
+#ifndef _FORMAT_HXX //autogen
+#include
+#endif
+#ifndef _SWATRSET_HXX
+#include
+#endif
+#ifndef _PARATR_HXX
+#include // fuer SetModifyAtAttr
+#endif
+#ifndef _CELLATR_HXX
+#include // fuer SetModifyAtAttr
+#endif
+#ifndef _CMDID_H
+#include
+#endif
+
+
+SwAttrPool::SwAttrPool( SwDoc* pD )
+ : SfxItemPool( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "SWG" )),
+ POOLATTR_BEGIN, POOLATTR_END-1,
+ aSlotTab, aAttrTab ),
+ pDoc( pD )
+{
+ SetVersionMap( 1, 1, 60, pVersionMap1 );
+ SetVersionMap( 2, 1, 75, pVersionMap2 );
+ SetVersionMap( 3, 1, 86, pVersionMap3 );
+}
+
+
+SwAttrSet::SwAttrSet( SwAttrPool& rPool, USHORT nWh1, USHORT nWh2 )
+ : SfxItemSet( rPool, nWh1, nWh2 ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+
+SwAttrSet::SwAttrSet( SwAttrPool& rPool, const USHORT* nWhichPairTable )
+ : SfxItemSet( rPool, nWhichPairTable ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+
+SwAttrSet::SwAttrSet( const SwAttrSet& rSet )
+ : SfxItemSet( rSet ), pOldSet( 0 ), pNewSet( 0 )
+{
+}
+
+
+int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ int nRet = 0 != SfxItemSet::Put( rAttr );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+int SwAttrSet::Put_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ int nRet = 0 != SfxItemSet::Put( rSet );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+
+USHORT SwAttrSet::ClearItem_BC( USHORT nWhich,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ USHORT nRet = SfxItemSet::ClearItem( nWhich );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+USHORT SwAttrSet::ClearItem_BC( USHORT nWhich1, USHORT nWhich2,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ ASSERT( nWhich1 <= nWhich2, "kein gueltiger Bereich" );
+ pNewSet = pNew;
+ pOldSet = pOld;
+ USHORT nRet = 0;
+ for( ; nWhich1 <= nWhich2; ++nWhich1 )
+ nRet += SfxItemSet::ClearItem( nWhich1 );
+ pOldSet = pNewSet = 0;
+ return nRet;
+}
+
+
+
+int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ SfxItemSet::Intersect( rSet );
+ pOldSet = pNewSet = 0;
+ return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
+}
+
+
+int SwAttrSet::Differentiate_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ SfxItemSet::Differentiate( rSet );
+ pOldSet = pNewSet = 0;
+ return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
+}
+
+
+int SwAttrSet::MergeValues_BC( const SfxItemSet& rSet,
+ SwAttrSet* pOld, SwAttrSet* pNew )
+{
+ pNewSet = pNew;
+ pOldSet = pOld;
+ SfxItemSet::MergeValues( rSet );
+ pOldSet = pNewSet = 0;
+ return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
+}
+
+
+ // Notification-Callback
+void SwAttrSet::Changed( const SfxPoolItem& rOld,
+ const SfxPoolItem& rNew )
+{
+ if( pOldSet )
+ pOldSet->PutChgd( rOld );
+
+ if( pNewSet )
+ pNewSet->PutChgd( rNew );
+}
+
+
+// ----------------------------------------------------------------
+// Sonderbehandlung fuer einige Attribute
+// Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
+// - SwFmtDropCaps
+// - SwFmtPageDesc
+// (Wird beim Einfuegen in Formate/Nodes gerufen)
+// ----------------------------------------------------------------
+void SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
+{
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == GetItemState( RES_PAGEDESC, FALSE, &pItem ) &&
+ ((SwFmtPageDesc*)pItem)->GetDefinedIn() != pModify )
+ {
+ ((SwFmtPageDesc*)pItem)->ChgDefinedIn( pModify );
+ }
+
+ if( SFX_ITEM_SET == GetItemState( RES_PARATR_NUMRULE, FALSE, &pItem ) &&
+ ((SwNumRuleItem*)pItem)->GetDefinedIn() != pModify )
+ {
+ ((SwNumRuleItem*)pItem)->ChgDefinedIn( pModify );
+ }
+
+ if( SFX_ITEM_SET == GetItemState( RES_PARATR_DROP, FALSE, &pItem ) &&
+ ((SwFmtDrop*)pItem)->GetDefinedIn() != pModify )
+ {
+ // CharFormat gesetzt und dann noch in unterschiedlichen
+ // Attribut Pools, dann muss das CharFormat kopiert werden!
+ SwCharFmt* pCharFmt;
+ if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() )
+ && GetPool() != pCharFmt->GetAttrSet().GetPool() )
+ {
+ pCharFmt = GetDoc()->CopyCharFmt( *pCharFmt );
+ ((SwFmtDrop*)pItem)->SetCharFmt( pCharFmt );
+ }
+ ((SwFmtDrop*)pItem)->ChgDefinedIn( pModify );
+ }
+
+ if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, FALSE, &pItem ) &&
+ ((SwTblBoxFormula*)pItem)->GetDefinedIn() != pModify )
+ {
+ ((SwTblBoxFormula*)pItem)->ChgDefinedIn( pModify );
+ }
+}
+
+
+void SwAttrSet::CopyToModify( SwModify& rMod ) const
+{
+ // kopiere die Attribute ggfs. ueber Dokumentgrenzen
+ SwCntntNode* pCNd = PTR_CAST( SwCntntNode, &rMod );
+ SwFmt* pFmt = PTR_CAST( SwFmt, &rMod );
+
+ if( pCNd || pFmt )
+ {
+ if( Count() )
+ {
+ const SfxPoolItem* pItem;
+ const SwDoc *pSrcDoc = GetDoc();
+ SwDoc *pDstDoc = pCNd ? pCNd->GetDoc() : pFmt->GetDoc();
+
+ // muss die NumRule kopiert werden?
+ if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
+ RES_PARATR_NUMRULE, FALSE, &pItem ) )
+ {
+ const String& rNm = ((SwNumRuleItem*)pItem)->GetValue();
+ if( rNm.Len() )
+ {
+ SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm );
+ if( pDestRule )
+ pDestRule->SetInvalidRule( TRUE );
+ else
+ pDstDoc->MakeNumRule( rNm,
+ pSrcDoc->FindNumRulePtr( rNm ) );
+ }
+ }
+
+ // JP 04.02.99: Task #61467# Seitenvorlagenwechsel mit kopieren
+ // Gegenueber dem alten Verhalten, sie zu entfernen
+ const SwPageDesc* pPgDesc;
+ if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
+ RES_PAGEDESC, FALSE, &pItem ) &&
+ 0 != ( pPgDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc()) )
+ {
+ SfxItemSet aTmpSet( *this );
+
+ // JP 09.02.99: und jetzt doch wieder nur entfernen
+ aTmpSet.ClearItem( RES_PAGEDESC );
+
+/*************************************************************************
+ SwPageDesc* pDstPgDesc = pDstDoc->FindPageDescByName(
+ pPgDesc->GetName() );
+ if( !pDstPgDesc )
+ {
+ // dann kopieren, ansonsten den benutzen
+ pDstPgDesc = &pDstDoc->_GetPageDesc( pDstDoc->MakePageDesc(
+ pPgDesc->GetName() ));
+ pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc );
+ }
+ SwFmtPageDesc aDesc( pDstPgDesc );
+ aDesc.SetNumOffset( ((SwFmtPageDesc*)pItem)->GetNumOffset() );
+ aTmpSet.Put( aDesc );
+************************************************************************/
+
+ if( pCNd )
+ pCNd->SetAttr( aTmpSet );
+ else
+ pFmt->SetAttr( aTmpSet );
+ }
+ else if( pCNd )
+ pCNd->SetAttr( *this );
+ else
+ pFmt->SetAttr( *this );
+ }
+ }
+#ifndef PRODUCT
+ else
+ ASSERT( !this, "weder Format noch ContentNode - keine Attribute kopiert");
+#endif
+}
+
+// check if ID is InRange of AttrSet-Ids
+BOOL IsInRange( const USHORT* pRange, const USHORT nId )
+{
+ while( *pRange )
+ {
+ if( *pRange <= nId && nId <= *(pRange+1) )
+ return TRUE;
+ pRange += 2;
+ }
+ return FALSE;
+}
+
+
+
+
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx
new file mode 100644
index 000000000000..f4bea49f78bd
--- /dev/null
+++ b/sw/source/core/bastyp/bparr.cxx
@@ -0,0 +1,634 @@
+/*************************************************************************
+ *
+ * $RCSfile: bparr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include
+#include
+#include "bparr.hxx"
+
+// die Blockverwaltung waechst/schrumpft immer um 20 Bloecke, das sind dann
+// immer ~ 20 * MAXENTRY == 20000 Eintraege
+const USHORT nBlockGrowSize = 20;
+
+#ifdef PRODUCT
+
+#define CHECKIDX( p, n, i, c )
+
+#else
+
+#define CHECKIDX( p, n, i, c ) CheckIdx( p, n, i, c );
+
+void CheckIdx( BlockInfo** ppInf, USHORT nBlock, ULONG nSize, USHORT nCur )
+{
+ DBG_ASSERT( !nSize || nCur < nBlock, "BigPtrArray: CurIndex steht falsch" );
+
+ ULONG nIdx = 0;
+ for( USHORT nCnt = 0; nCnt < nBlock; ++nCnt, ++ppInf )
+ {
+ nIdx += (*ppInf)->nElem;
+ // Array mit Luecken darf es nicht geben
+ DBG_ASSERT( !nCnt || (*(ppInf-1))->nEnd + 1 == (*ppInf)->nStart,
+ "BigPtrArray: Luecke in der Verwaltung!" );
+ }
+
+ DBG_ASSERT( nIdx == nSize, "BigPtrArray: Anzahl ungueltig" );
+}
+
+#endif
+
+
+BigPtrArray::BigPtrArray()
+{
+ nBlock = nCur = 0;
+ nSize = 0;
+ nMaxBlock = nBlockGrowSize; // == 20 * 1000 Eintraege
+ ppInf = new BlockInfo* [ nMaxBlock ];
+}
+
+
+
+BigPtrArray::~BigPtrArray()
+{
+ if( nBlock )
+ {
+ BlockInfo** pp = ppInf;
+ for( USHORT n = 0; n < nBlock; ++n, ++pp )
+ {
+ __DELETE( (*pp)->nElem ) (*pp)->pData;
+ delete *pp;
+ }
+ }
+ __DELETE( nMaxBlock ) ppInf;
+}
+
+// Einfachst-Implementation, evtl. spaeter mal komplexer
+#if 0
+void BigPtrArray::Insert( const ElementPtr* p, ULONG pos, ULONG n )
+{
+ while( n-- )
+ Insert( *p++, pos++ );
+}
+#endif
+
+// Auch der Move ist schlicht. Optimieren ist hier wg. der
+// Stueckelung des Feldes zwecklos!
+
+void BigPtrArray::Move( ULONG from, ULONG to )
+{
+ USHORT cur = Index2Block( from );
+ BlockInfo* p = ppInf[ cur ];
+ ElementPtr pElem = p->pData[ from - p->nStart ];
+ Insert( pElem, to ); // erst einfuegen, dann loeschen !!!!
+ Remove( ( to < from ) ? ( from + 1 ) : from );
+}
+
+// das Ende ist EXCLUSIV
+
+
+void BigPtrArray::ForEach( ULONG nStart, ULONG nEnd,
+ FnForEach fn, void* pArgs )
+{
+ if( nEnd > nSize )
+ nEnd = nSize;
+
+ if( nStart < nEnd )
+ {
+ USHORT cur = Index2Block( nStart );
+ BlockInfo** pp = ppInf + cur;
+ BlockInfo* p = *pp;
+ USHORT nElem = USHORT( nStart - p->nStart );
+ ElementPtr* pElem = p->pData + nElem;
+ nElem = p->nElem - nElem;
+ for(;;)
+ {
+ if( !(*fn)( *pElem++, pArgs ) || ++nStart >= nEnd )
+ break;
+
+ // naechstes Element
+ if( !--nElem )
+ {
+ // neuer Block
+ p = *++pp;
+ pElem = p->pData;
+ nElem = p->nElem;
+ }
+ }
+ }
+}
+
+
+ElementPtr BigPtrArray::operator[]( ULONG idx ) const
+{
+ // weil die Funktion eben doch nicht const ist:
+ DBG_ASSERT( idx < nSize, "operator[]: Index aussserhalb" );
+ BigPtrArray* pThis = (BigPtrArray*) this;
+ USHORT cur = Index2Block( idx );
+ BlockInfo* p = ppInf[ cur ];
+ pThis->nCur = cur;
+ return p->pData[ idx - p->nStart ];
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+// private Methoden
+
+// Suchen des Blocks einer bestimmten Position
+// Algorithmus:
+// 1. Test, ob der letzte Block der gesuchte Block ist
+// 2. Sonderfall: Index = 0?
+// 3. Test der Nachbarbloecke
+
+// 4. Binaere Suche
+
+
+
+USHORT BigPtrArray::Index2Block( ULONG pos ) const
+{
+ // zuletzt verwendeter Block?
+ BlockInfo* p = ppInf[ nCur ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return nCur;
+ // Index = 0?
+ if( !pos )
+ return 0;
+ // Folgeblock?
+ if( nCur < ( nBlock - 1 ) )
+ {
+ p = ppInf[ nCur+1 ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return nCur+1;
+ }
+ // vorangehender Block?
+ else if( pos < p->nStart && nCur > 0 )
+ {
+ p = ppInf[ nCur-1 ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return nCur-1;
+ }
+ // Binaere Suche:
+ // Diese fuehrt immer zum Erfolg
+ USHORT lower = 0, upper = nBlock - 1;
+ USHORT cur = 0;
+ for(;;)
+ {
+ USHORT n = lower + ( upper - lower ) / 2;
+ cur = ( n == cur ) ? n+1 : n;
+ p = ppInf[ cur ];
+ if( p->nStart <= pos && p->nEnd >= pos )
+ return cur;
+ if( p->nStart > pos )
+ upper = cur;
+ else
+ lower = cur;
+ }
+}
+
+
+// Update aller Indexbereiche ab einer bestimmten Position
+
+// pos bezeichnet den letzten korrekten Block
+
+void BigPtrArray::UpdIndex( USHORT pos )
+{
+ BlockInfo** pp = ppInf + pos;
+ ULONG idx = (*pp)->nEnd + 1;
+ BlockInfo* p;
+ while( ++pos < nBlock )
+ {
+ p = *++pp;
+ p->nStart = idx;
+ idx += p->nElem;
+ p->nEnd = idx - 1;
+ }
+}
+
+// Einrichten eines neuen Blocks an einer bestimmten Position
+
+// Vorhandene Blocks werden nach hinten verschoben
+
+
+
+BlockInfo* BigPtrArray::InsBlock( USHORT pos )
+{
+ if( nBlock == nMaxBlock )
+ {
+ // dann sollte wir mal das Array erweitern
+ BlockInfo** ppNew = new BlockInfo* [ nMaxBlock + nBlockGrowSize ];
+ memcpy( ppNew, ppInf, nMaxBlock * sizeof( BlockInfo* ));
+ __DELETE( nMaxBlock ) ppInf;
+ nMaxBlock += nBlockGrowSize;
+ ppInf = ppNew;
+ }
+ if( pos != nBlock )
+ memmove( ppInf + pos+1, ppInf + pos ,
+ ( nBlock - pos ) * sizeof (BlockInfo*) );
+ ++nBlock;
+ BlockInfo* p = new BlockInfo;
+ ppInf[ pos ] = p;
+
+ if( pos )
+ p->nStart = p->nEnd = ppInf[ pos-1 ]->nEnd + 1;
+ else
+ p->nStart = p->nEnd = 0;
+ p->nEnd--; // keine Elemente
+ p->nElem = 0;
+ p->pData = new ElementPtr [ MAXENTRY ];
+ p->pBigArr = this;
+ return p;
+}
+
+void BigPtrArray::BlockDel( USHORT nDel )
+{
+ nBlock -= nDel;
+ if( nMaxBlock - nBlock > nBlockGrowSize )
+ {
+ // dann koennen wir wieder schrumpfen
+ nDel = (( nBlock / nBlockGrowSize ) + 1 ) * nBlockGrowSize;
+ BlockInfo** ppNew = new BlockInfo* [ nDel ];
+ memcpy( ppNew, ppInf, nBlock * sizeof( BlockInfo* ));
+ __DELETE( nMaxBlock ) ppInf;
+ ppInf = ppNew;
+ nMaxBlock = nDel;
+ }
+}
+
+
+void BigPtrArray::Insert( const ElementPtr& rElem, ULONG pos )
+{
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ BlockInfo* p;
+ USHORT cur;
+ if( !nSize )
+ // Sonderfall: erstes Element einfuegen
+ p = InsBlock( cur = 0 );
+ else if( pos == nSize )
+ {
+ // Sonderfall: Einfuegen am Ende
+ cur = nBlock - 1;
+ p = ppInf[ cur ];
+ if( p->nElem == MAXENTRY )
+ // Der letzte Block ist voll, neuen anlegen
+ p = InsBlock( ++cur );
+ }
+ else
+ {
+ // Standardfall:
+ cur = Index2Block( pos );
+ p = ppInf[ cur ];
+ }
+ if( p->nElem == MAXENTRY )
+ {
+ // passt der letzte Eintrag in den naechsten Block?
+ BlockInfo* q;
+ if( cur < ( nBlock - 1 ) && ppInf[ cur+1 ]->nElem < MAXENTRY )
+ {
+ q = ppInf[ cur+1 ];
+ if( q->nElem )
+ {
+ register int nCount = q->nElem;
+ register ElementPtr *pFrom = q->pData + nCount,
+ *pTo = pFrom+1;
+ while( nCount-- )
+ ++( *--pTo = *--pFrom )->nOffset;
+ }
+ q->nStart--;
+ q->nEnd--;
+ }
+ else
+ {
+ // Wenn er auch nicht in den Folgeblock passt, muss ein
+ // neuer Block eingefuegt werden
+ // erst mal bei Bedarf komprimieren
+
+ // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
+ // Compress aufrufen
+ if( /*nBlock == nMaxBlock &&*/
+ nBlock > ( nSize / ( MAXENTRY / 2 ) ) &&
+ cur >= Compress() )
+ {
+ // es wurde vor der akt. Pos etwas verschoben und alle
+ // Pointer koennen ungueltig sein. Also das Insert
+ // nochmals aufsetzen
+ Insert( rElem, pos );
+ return ;
+ }
+
+ q = InsBlock( cur+1 );
+ }
+
+ // Eintrag passt nicht mehr. Dann muss Platz gemacht werden
+ ElementPtr pLast = p->pData[ MAXENTRY-1 ];
+ pLast->nOffset = 0;
+ pLast->pBlock = q;
+
+ q->pData[ 0 ] = pLast;
+ q->nElem++;
+ q->nEnd++;
+
+ p->nEnd--;
+ p->nElem--;
+ }
+ // Nun haben wir einen freien Block am Wickel: eintragen
+ pos -= p->nStart;
+ DBG_ASSERT( pos < MAXENTRY, "falsche Pos" );
+ if( pos != p->nElem )
+ {
+ register int nCount = p->nElem - USHORT(pos);
+ register ElementPtr *pFrom = p->pData + p->nElem,
+ *pTo = pFrom + 1;
+ while( nCount-- )
+ ++( *--pTo = *--pFrom )->nOffset;
+ }
+ // Element eintragen und Indexe updaten
+ ((ElementPtr&)rElem)->nOffset = USHORT(pos);
+ ((ElementPtr&)rElem)->pBlock = p;
+ p->pData[ pos ] = rElem;
+ p->nEnd++;
+ p->nElem++;
+ nSize++;
+ if( cur != ( nBlock - 1 ) ) UpdIndex( cur );
+ nCur = cur;
+
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+}
+
+void BigPtrArray::Remove( ULONG pos, ULONG n )
+{
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ USHORT nBlkdel = 0; // entfernte Bloecke
+ USHORT cur = Index2Block( pos ); // aktuelle Blocknr
+ USHORT nBlk1 = cur; // 1. behandelter Block
+ USHORT nBlk1del = USHRT_MAX; // 1. entfernter Block
+ BlockInfo* p = ppInf[ cur ];
+ pos -= p->nStart;
+ ULONG nElem = n;
+ while( nElem )
+ {
+ USHORT nel = p->nElem - USHORT(pos);
+ if( ULONG(nel) > nElem )
+ nel = USHORT(nElem);
+ // Eventuell Elemente verschieben
+ if( ( pos + nel ) < ULONG(p->nElem) )
+ {
+ register ElementPtr *pTo = p->pData + pos,
+ *pFrom = pTo + nel;
+ register int nCount = p->nElem - nel - USHORT(pos);
+ while( nCount-- )
+ {
+ (*pTo++ = *pFrom++)->nOffset -= nel;
+// (*pTo++)->nOffset -= nel;
+ }
+ }
+ p->nEnd -= nel;
+ p->nElem -= nel;
+ if( !p->nElem )
+ {
+ // eventuell Block ganz entfernen
+ delete p->pData;
+ nBlkdel++;
+ if( USHRT_MAX == nBlk1del )
+ nBlk1del = cur;
+ }
+ p = ppInf[ ++cur ];
+ nElem -= nel;
+ pos = 0;
+ }
+ // Am Ende die Tabelle updaten, falls Bloecke geloescht waren
+ if( nBlkdel )
+ {
+ // loeschen sollte man immer !!
+ for( USHORT i = nBlk1del; i < ( nBlk1del + nBlkdel ); i++ )
+ delete ppInf[ i ];
+
+ if( ( nBlk1del + nBlkdel ) < nBlock )
+ {
+ memmove( ppInf + nBlk1del, ppInf + nBlk1del + nBlkdel,
+ ( nBlock - nBlkdel - nBlk1del ) * sizeof( BlockInfo* ) );
+
+ // JP 19.07.95: nicht den ersten behandelten, sondern den davor!!
+ // UpdateIdx updatet nur alle Nachfolgende!!
+ if( !nBlk1 )
+ {
+ p = ppInf[ 0 ];
+ p->nStart = 0;
+ p->nEnd = p->nElem-1;
+ }
+ else
+ --nBlk1;
+ }
+ BlockDel( nBlkdel ); // es wurden Bloecke geloescht
+ }
+
+ nSize -= n;
+ if( nBlk1 != ( nBlock - 1 ) && nSize )
+ UpdIndex( nBlk1 );
+ nCur = nBlk1;
+
+ // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
+ // Compress aufrufen
+ if( nBlock > ( nSize / ( MAXENTRY / 2 ) ) )
+ Compress();
+
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+}
+
+
+void BigPtrArray::Replace( ULONG idx, const ElementPtr& rElem)
+{
+ // weil die Funktion eben doch nicht const ist:
+ DBG_ASSERT( idx < nSize, "Set: Index aussserhalb" );
+ BigPtrArray* pThis = (BigPtrArray*) this;
+ USHORT cur = Index2Block( idx );
+ BlockInfo* p = ppInf[ cur ];
+ pThis->nCur = cur;
+ ((ElementPtr&)rElem)->nOffset = USHORT(idx - p->nStart);
+ ((ElementPtr&)rElem)->pBlock = p;
+ p->pData[ idx - p->nStart ] = rElem;
+}
+
+
+// Index eines Eintrags heraussuchen
+// Dies ist der selbe Code wie in ForEach() mit dem Unterschied,
+// dass statt einer Funktion ein Vergleich durchgefuehrt wird.
+// Man haette auch ForEach() nehmen koennen, spart aber durch
+// den fehlenden Call etwas Zeit.
+
+
+ULONG BigPtrArray::GetIndex
+ ( const ElementPtr pTest, ULONG nStart, ULONG nEnd ) const
+{
+ DBG_ASSERT( pTest == pTest->pBlock->pData[ pTest->nOffset ],
+ "Element nicht im Block" );
+ return pTest->pBlock->nStart + pTest->nOffset;
+}
+
+// Array komprimieren
+
+USHORT BigPtrArray::Compress( short nMax )
+{
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ // Es wird von vorne nach hinten ueber das InfoBlock Array iteriert.
+ // Wenn zwischen durch Block gel”scht werden, dann mussen alle
+ // nachfolgenden verschoben werden. Dazu werden die Pointer pp und qq
+ // benutzt; wobei pp das "alte" Array, qq das "neue" Array ist.
+ BlockInfo** pp = ppInf, **qq = pp;
+ BlockInfo* p;
+ BlockInfo* pLast; // letzter nicht voller Block
+ USHORT nLast = 0; // fehlende Elemente
+ USHORT nBlkdel = 0; // Anzahl der geloeschte Bloecke
+ USHORT nFirstChgPos = USHRT_MAX; // ab welcher Pos gab es die 1. Aenderung?
+
+ // von Fuell-Prozenten auf uebrige Eintrage umrechnen
+ nMax = MAXENTRY - (long) MAXENTRY * nMax / 100;
+
+ for( USHORT cur = 0; cur < nBlock; ++cur )
+ {
+ p = *pp++;
+ USHORT n = p->nElem;
+ // Testen, ob der noch nicht volle Block so gelassen wird
+ // dies ist der Fall, wenn der aktuelle Block gesplittet
+ // werden muesste, der noch nicht volle Block aber bereits
+ // ueber dem uebergebenen Break-Wert voll ist. In diesem
+ // Fall wird von einer weiteren Fuellung (die ja wegen dem
+ // zweifachen memmove() zeitaufwendig ist) abgesehen.
+ if( nLast && ( n > nLast ) && ( nLast < nMax ) )
+ nLast = 0;
+ if( nLast )
+ {
+ if( USHRT_MAX == nFirstChgPos )
+ nFirstChgPos = cur;
+
+ // ein nicht voller Block vorhanden: auffuellen
+ if( n > nLast )
+ n = nLast;
+
+ // Elemente uebertragen, vom akt. in den letzten
+ register ElementPtr* pElem = pLast->pData + pLast->nElem;
+ register ElementPtr* pFrom = p->pData;
+ for( register int nCount = n, nOff = pLast->nElem;
+ nCount; --nCount, ++pElem )
+ *pElem = *pFrom++,
+ (*pElem)->pBlock = pLast,
+ (*pElem)->nOffset = nOff++;
+
+ // korrigieren
+ pLast->nElem += n;
+ nLast -= n;
+ p->nElem -= n;
+
+ // Ist der aktuelle Block dadurch leer geworden?
+ if( !p->nElem )
+ {
+ // dann kann der entfernt werden
+ delete p->pData;
+ delete p, p = 0;
+ ++nBlkdel;
+ }
+ else
+ {
+ pElem = p->pData, pFrom = pElem + n;
+ register int nCount = p->nElem;
+ while( nCount-- )
+ {
+ (*pElem++ = *pFrom++)->nOffset -= n;
+ }
+ }
+ }
+
+ if( p ) // die Blockinfo wurde nicht geloescht
+ {
+ *qq++ = p; // dann setze sie an die richtige neue Position
+
+ // eventuell den letzten halbvollen Block festhalten
+ if( !nLast && p->nElem < MAXENTRY )
+ {
+ pLast = p;
+ nLast = MAXENTRY - p->nElem;
+ }
+ }
+ }
+
+ // Bloecke geloescht wurden, ggfs. das BlockInfo Array verkuerzen
+ if( nBlkdel )
+ BlockDel( nBlkdel );
+
+ // Und neu durchindizieren
+ p = ppInf[ 0 ];
+ p->nEnd = p->nElem - 1;
+ UpdIndex( 0 );
+
+ if( nCur >= nFirstChgPos )
+ nCur = 0;
+
+ CHECKIDX( ppInf, nBlock, nSize, nCur );
+
+ return nFirstChgPos;
+}
+
+
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
new file mode 100644
index 000000000000..54f00db8e20a
--- /dev/null
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * $RCSfile: breakit.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include "breakit.hxx"
+#include "viewsh.hxx"
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include
+#endif
+
+#include
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::linguistic;
+
+
+
+SwBreakIt::SwBreakIt()
+{
+ _GetLocale( LANGUAGE_NONE );
+ Reference< XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ Reference < XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.text.BreakIterator" ) );
+ if ( xI.is() )
+ {
+ Any x = xI->queryInterface( ::getCppuType((const Reference< XBreakIterator >*)0) );
+ x >>= xBreak;
+ }
+}
+
+Locale& SwBreakIt::_GetLocale( const LanguageType aLang )
+{
+ aLast = aLang;
+ pLocale = new Locale( SvxCreateLocale( aLast ) );
+ return *pLocale;
+}
+
+
+
+
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
new file mode 100644
index 000000000000..88355531b9ea
--- /dev/null
+++ b/sw/source/core/bastyp/calc.cxx
@@ -0,0 +1,1841 @@
+/*************************************************************************
+ *
+ * $RCSfile: calc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+
+#include
+#ifdef MAC
+#include
+#else
+#include
+#endif
+#include
+#include
+#include
+
+#ifndef _HINTIDS_HXX
+#include
+#endif
+
+#ifdef WNT
+#include
+#endif
+
+#ifndef _INTN_HXX //autogen
+#include
+#endif
+#ifndef _TOOLS_SOLMATH_HXX
+#include
+#endif
+#ifndef _SV_SYSTEM_HXX
+#include
+#endif
+#ifndef _APP_HXX //autogen
+#include
+#endif
+#ifndef _SBA_SBADB_HXX //autogen
+#include
+#endif
+#ifndef _SBA_SBAOBJ_HXX //autogen
+#include
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include
+#endif
+#ifndef _SVX_ADRITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_LANGITEM_HXX
+#include
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include
+#endif
+#ifndef _UNO_LINGU_HXX
+#include
+#endif
+
+#ifndef _DOC_HXX
+#include
+#endif
+#ifndef _VIEWSH_HXX
+#include
+#endif
+#ifndef _DOCSTAT_HXX //autogen
+#include
+#endif
+#ifndef _CALC_HXX
+#include
+#endif
+#ifndef _SHELLRES_HXX
+#include
+#endif
+#ifndef _DBFLD_HXX
+#include
+#endif
+#ifndef _EXPFLD_HXX
+#include
+#endif
+#ifndef _USRFLD_HXX
+#include
+#endif
+#ifndef _DBMGR_HXX
+#include
+#endif
+#ifndef _DOCFLD_HXX
+#include
+#endif
+#ifndef _FINDER_HXX
+#include
+#endif
+
+
+// tippt sich schneller
+#define RESOURCE ViewShell::GetShellRes()
+
+const sal_Char __FAR_DATA sCalc_Add[] = "add";
+const sal_Char __FAR_DATA sCalc_Sub[] = "sub";
+const sal_Char __FAR_DATA sCalc_Mul[] = "mul";
+const sal_Char __FAR_DATA sCalc_Div[] = "div";
+const sal_Char __FAR_DATA sCalc_Phd[] = "phd";
+const sal_Char __FAR_DATA sCalc_Sqrt[] = "sqrt";
+const sal_Char __FAR_DATA sCalc_Pow[] = "pow";
+const sal_Char __FAR_DATA sCalc_Or[] = "or";
+const sal_Char __FAR_DATA sCalc_Xor[] = "xor";
+const sal_Char __FAR_DATA sCalc_And[] = "and";
+const sal_Char __FAR_DATA sCalc_Not[] = "not";
+const sal_Char __FAR_DATA sCalc_Eq[] = "eq";
+const sal_Char __FAR_DATA sCalc_Neq[] = "neq";
+const sal_Char __FAR_DATA sCalc_Leq[] = "leq";
+const sal_Char __FAR_DATA sCalc_Geq[] = "geq";
+const sal_Char __FAR_DATA sCalc_L[] = "l";
+const sal_Char __FAR_DATA sCalc_G[] = "g";
+const sal_Char __FAR_DATA sCalc_Sum[] = "sum";
+const sal_Char __FAR_DATA sCalc_Mean[] = "mean";
+const sal_Char __FAR_DATA sCalc_Min[] = "min";
+const sal_Char __FAR_DATA sCalc_Max[] = "max";
+const sal_Char __FAR_DATA sCalc_Sin[] = "sin";
+const sal_Char __FAR_DATA sCalc_Cos[] = "cos";
+const sal_Char __FAR_DATA sCalc_Tan[] = "tan";
+const sal_Char __FAR_DATA sCalc_Asin[] = "asin";
+const sal_Char __FAR_DATA sCalc_Acos[] = "acos";
+const sal_Char __FAR_DATA sCalc_Atan[] = "atan";
+const sal_Char __FAR_DATA sCalc_Tdif[] = "timediff";
+const sal_Char __FAR_DATA sCalc_Round[] = "round";
+
+
+
+//!!!!! ACHTUNG - Sortierte Liste aller Operatoren !!!!!
+struct _CalcOp
+{
+ union{
+ const sal_Char* pName;
+ const String* pUName;
+ };
+ SwCalcOper eOp;
+};
+
+_CalcOp __READONLY_DATA aOpTable[] = {
+/* ACOS */ sCalc_Acos, CALC_ACOS, // Arcuscosinus
+/* ADD */ sCalc_Add, CALC_PLUS, // Addition
+/* AND */ sCalc_And, CALC_AND, // log. und
+/* ASIN */ sCalc_Asin, CALC_ASIN, // Arcussinus
+/* ATAN */ sCalc_Atan, CALC_ATAN, // Arcustangens
+/* COS */ sCalc_Cos, CALC_COS, // Cosinus
+/* DIV */ sCalc_Div, CALC_DIV, // Dividieren
+/* EQ */ sCalc_Eq, CALC_EQ, // gleich
+/* G */ sCalc_G, CALC_GRE, // groesser
+/* GEQ */ sCalc_Geq, CALC_GEQ, // groesser gleich
+/* L */ sCalc_L, CALC_LES, // kleiner
+/* LEQ */ sCalc_Leq, CALC_LEQ, // kleiner gleich
+/* MAX */ sCalc_Max, CALC_MAX, // Maximalwert
+/* MEAN */ sCalc_Mean, CALC_MEAN, // Mittelwert
+/* MIN */ sCalc_Min, CALC_MIN, // Minimalwert
+/* MUL */ sCalc_Mul, CALC_MUL, // Multiplizieren
+/* NEQ */ sCalc_Neq, CALC_NEQ, // nicht gleich
+/* NOT */ sCalc_Not, CALC_NOT, // log. nicht
+/* OR */ sCalc_Or, CALC_OR, // log. oder
+/* PHD */ sCalc_Phd, CALC_PHD, // Prozent
+/* POW */ sCalc_Pow, CALC_POW, // Potenzieren
+/* ROUND */ sCalc_Round, CALC_ROUND, // Runden
+/* SIN */ sCalc_Sin, CALC_SIN, // Sinus
+/* SQRT */ sCalc_Sqrt, CALC_SQRT, // Wurzel
+/* SUB */ sCalc_Sub, CALC_MINUS, // Subtraktion
+/* SUM */ sCalc_Sum, CALC_SUM, // Summe
+/* TAN */ sCalc_Tan, CALC_TAN, // Tangens
+/* TIMEDIFF */sCalc_Tdif, CALC_TDIF, // Zeitspanne
+/* XOR */ sCalc_Xor, CALC_XOR // log. xoder
+};
+
+double __READONLY_DATA nRoundVal[] = {
+ 5.0e+0, 0.5e+0, 0.5e-1, 0.5e-2, 0.5e-3, 0.5e-4, 0.5e-5, 0.5e-6,
+ 0.5e-7, 0.5e-8, 0.5e-9, 0.5e-10,0.5e-11,0.5e-12,0.5e-13,0.5e-14,
+ 0.5e-15,0.5e-16
+};
+
+double __READONLY_DATA nKorrVal[] = {
+ 9, 9e-1, 9e-2, 9e-3, 9e-4, 9e-5, 9e-6, 9e-7, 9e-8,
+ 9e-9, 9e-10, 9e-11, 9e-12, 9e-13, 9e-14
+};
+
+extern "C" {
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC )
+ _Optlink
+#endif
+ OperatorCompare( const void *pFirst, const void *pSecond)
+{
+ int nRet = 0;
+ if( CALC_NAME == ((_CalcOp*)pFirst)->eOp )
+ {
+ if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
+ nRet = ((_CalcOp*)pFirst)->pUName->CompareTo(
+ *((_CalcOp*)pSecond)->pUName );
+ else
+ nRet = ((_CalcOp*)pFirst)->pUName->CompareToAscii(
+ ((_CalcOp*)pSecond)->pName );
+ }
+ else
+ {
+ if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
+ nRet = -1 * ((_CalcOp*)pSecond)->pUName->CompareToAscii(
+ ((_CalcOp*)pFirst)->pName );
+ else
+ nRet = strcmp( ((_CalcOp*)pFirst)->pName,
+ ((_CalcOp*)pSecond)->pName );
+ }
+ return nRet;
+}
+
+}// extern "C"
+
+_CalcOp* FindOperator( const String& rSrch )
+{
+ _CalcOp aSrch;
+ aSrch.pUName = &rSrch;
+ aSrch.eOp = CALC_NAME;
+
+ return (_CalcOp*)bsearch( (void*) &aSrch,
+ (void*) aOpTable,
+ sizeof( aOpTable ) / sizeof( _CalcOp ),
+ sizeof( _CalcOp ),
+ OperatorCompare );
+}
+
+inline void EatWhite( const String& rStr, xub_StrLen& rPos )
+{
+ sal_Unicode c;
+ while( rPos < rStr.Len() && ( ( c = rStr.GetChar( rPos ) ) == ' ' ||
+ c == '\t' || c == '\x0a' || c == '\x0d' ))
+ ++rPos;
+}
+
+inline sal_Unicode NextCh( const String& rStr, xub_StrLen& rPos )
+{
+ return rPos < rStr.Len() ? rStr.GetChar( rPos++ ) : 0;
+}
+
+//-----------------------------------------------------------------------------
+
+SwHash* Find( const String& rStr, SwHash** ppTable, USHORT nTblSize,
+ USHORT* pPos )
+{
+ ULONG ii = 0, n;
+ for( n = 0; n < rStr.Len(); ++n )
+ ii = ii << 1 ^ rStr.GetChar( n );
+ ii %= nTblSize;
+
+ if( pPos )
+ *pPos = (USHORT)ii;
+
+ for( SwHash* pEntry = *(ppTable+ii); pEntry; pEntry = pEntry->pNext )
+ if( rStr == pEntry->aStr )
+ return pEntry;
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+
+/******************************************************************************
+|*
+|* SwCalc::SwCalc( SwDoc* pD ) :
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+SwCalc::SwCalc( SwDoc& rD )
+ : rDoc( rD ),
+ eError( CALC_NOERR ),
+ nListPor( 0 ),
+ aErrExpr( aEmptyStr, SwSbxValue(), 0 ),
+ pInter( (International*)&Application::GetAppInternational() ),
+ pCharClass( &GetAppCharClass() )
+{
+ aErrExpr.aStr.AssignAscii( "~C_ERR~" );
+ memset( VarTable, 0, sizeof(VarTable) );
+ LanguageType eLang = ((SvxLanguageItem&)rDoc.GetDefault(
+ RES_CHRATR_LANGUAGE )).GetLanguage();
+ if( pInter->GetFormatLanguage() != eLang )
+ {
+ pInter = new International( eLang );
+ pCharClass = new CharClass( SvxCreateLocale( eLang ));
+
+#ifdef JP_DEBUG
+ printf( "Language: %d, AppLang: %d, AppFmtLang: %d, Decimal: %c, Thousand: %c\n",
+ pInter->GetLanguage(),
+ Application::GetAppInternational().GetLanguage(),
+ Application::GetAppInternational().GetFormatLanguage(),
+ pInter->GetNumDecimalSep(),
+ pInter->GetNumThousandSep() );
+#endif
+ }
+
+ sCurrSym = pInter->GetCurrSymbol();
+ sCurrSym.EraseLeadingChars().EraseTrailingChars();
+ pCharClass->toLower( sCurrSym );
+
+static sal_Char __READONLY_DATA
+ sNType0[] = "false",
+ sNType1[] = "true",
+ sNType2[] = "pi",
+ sNType3[] = "e",
+ sNType4[] = "tables",
+ sNType5[] = "graf",
+ sNType6[] = "ole",
+ sNType7[] = "page",
+ sNType8[] = "para",
+ sNType9[] = "word",
+ sNType10[]= "char",
+
+ sNType11[] = "user_firstname" ,
+ sNType12[] = "user_lastname" ,
+ sNType13[] = "user_initials" ,
+ sNType14[] = "user_company" ,
+ sNType15[] = "user_street" ,
+ sNType16[] = "user_country" ,
+ sNType17[] = "user_zipcode" ,
+ sNType18[] = "user_city" ,
+ sNType19[] = "user_title" ,
+ sNType20[] = "user_position" ,
+ sNType21[] = "user_tel_work" ,
+ sNType22[] = "user_tel_home" ,
+ sNType23[] = "user_fax" ,
+ sNType24[] = "user_email" ,
+ sNType25[] = "user_state" ,
+ sNType26[] = "graph"
+ ;
+
+static const sal_Char* __READONLY_DATA sNTypeTab[ 27 ] =
+{
+ sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
+ sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
+ sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
+ sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
+ sNType24,
+
+ // diese sind mit doppelten HashIds
+ sNType25, sNType26
+};
+static USHORT __READONLY_DATA aHashValue[ 27 ] =
+{
+ 34, 38, 43, 7, 18, 32, 22, 29, 30, 33, 3,
+ 28, 24, 40, 9, 11, 26, 45, 4, 23, 36, 44, 19, 5, 1,
+ // diese sind mit doppelten HashIds
+ 11, 38
+};
+static AddressToken __READONLY_DATA aAdrToken[ 12 ] =
+{
+ ADDRESS_COMPANY, ADDRESS_STREET, ADDRESS_COUNTRY, ADDRESS_PLZ,
+ ADDRESS_CITY, ADDRESS_TITLE, ADDRESS_POSITION, ADDRESS_TEL_COMPANY,
+ ADDRESS_TEL_PRIVATE, ADDRESS_FAX, ADDRESS_EMAIL, ADDRESS_STATE
+};
+
+static USHORT SwDocStat::* __READONLY_DATA aDocStat1[ 3 ] =
+{
+ &SwDocStat::nTbl, &SwDocStat::nGrf, &SwDocStat::nOLE
+};
+static ULONG SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] =
+{
+ &SwDocStat::nPage, &SwDocStat::nPara,
+ &SwDocStat::nWord, &SwDocStat::nChar
+};
+
+#if TBLSZ != 47
+#error Alle Hashwerte angepasst?
+#endif
+
+ const SwDocStat& rDocStat = rDoc.GetDocStat();
+
+ SwSbxValue nVal;
+ String sTmpStr;
+ for( USHORT n = 0; n < 25; ++n )
+ {
+ sTmpStr.AssignAscii( sNTypeTab[ n ] );
+ VarTable[ aHashValue[ n ] ] = new SwCalcExp( sTmpStr, nVal, 0 );
+ }
+
+ ((SwCalcExp*)VarTable[ aHashValue[ 0 ] ])->nValue.PutBool( FALSE );
+ ((SwCalcExp*)VarTable[ aHashValue[ 1 ] ])->nValue.PutBool( TRUE );
+ ((SwCalcExp*)VarTable[ aHashValue[ 2 ] ])->nValue.PutDouble( F_PI );
+ ((SwCalcExp*)VarTable[ aHashValue[ 3 ] ])->nValue.PutDouble( 2.7182818284590452354 );
+
+ for( n = 0; n < 3; ++n )
+ ((SwCalcExp*)VarTable[ aHashValue[ n + 4 ] ])->nValue.PutLong( rDocStat.*aDocStat1[ n ] );
+ for( n = 0; n < 4; ++n )
+ ((SwCalcExp*)VarTable[ aHashValue[ n + 7 ] ])->nValue.PutLong( rDocStat.*aDocStat2[ n ] );
+
+ SvxAddressItem aAdr( pPathFinder->GetAddress() );
+
+ ((SwCalcExp*)VarTable[ aHashValue[ 11 ] ])->nValue.PutString( aAdr.GetFirstName() );
+ ((SwCalcExp*)VarTable[ aHashValue[ 12 ] ])->nValue.PutString( aAdr.GetName() );
+ ((SwCalcExp*)VarTable[ aHashValue[ 13 ] ])->nValue.PutString( aAdr.GetShortName() );
+
+ for( n = 0; n < 11; ++n )
+ ((SwCalcExp*)VarTable[ aHashValue[ n + 14 ] ])->nValue.PutString(
+ aAdr.GetToken( aAdrToken[ n ] ));
+
+ nVal.PutString( aAdr.GetToken( aAdrToken[ 11 ] ));
+ sTmpStr.AssignAscii( sNTypeTab[ 25 ] );
+ VarTable[ aHashValue[ 25 ] ]->pNext = new SwCalcExp( sTmpStr, nVal, 0 );
+
+// at time its better not to use "graph", because then the im-/export have
+// to change in all formulas this name.
+// nVal.PutLong( rDocStat.*aDocStat1[ 1 ] );
+// VarTable[ aHashValue[ 26 ] ]->pNext = new SwCalcExp(
+// sNTypeTab[ 26 ], nVal, 0 );
+}
+
+/******************************************************************************
+|*
+|* SwCalc::~SwCalc()
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+SwCalc::~SwCalc()
+{
+ for( USHORT n = 0; n < TBLSZ; ++n )
+ delete VarTable[n];
+ if( pInter != (International*)&Application::GetAppInternational() )
+ delete pInter;
+ if( pCharClass != &GetAppCharClass() )
+ delete pCharClass;
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Calculate( const String& rStr )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+SwSbxValue SwCalc::Calculate( const String& rStr )
+{
+ eError = CALC_NOERR;
+ SwSbxValue nResult;
+
+ if( !rStr.Len() )
+ return nResult;
+
+ nListPor = 0;
+ eCurrListOper = CALC_PLUS; // defaulten auf Summe
+
+ sCommand = rStr;
+ nCommandPos = 0;
+
+ while( (eCurrOper = GetToken()) != CALC_ENDCALC && eError == CALC_NOERR )
+ nResult = Expr();
+
+ if( eError )
+ nResult.PutDouble( DBL_MAX );
+
+#ifndef PRODUCT
+ SbxDataType eResDType = nResult.GetType();
+ const String& rResStr = nResult.GetString();
+#endif
+ return nResult;
+}
+
+/******************************************************************************
+|*
+|* String SwCalc::GetStrResult( SwSbxValue nValue, BOOL bRound = TRUE )
+|* Beschreibung Der Parameter bRound ist auf TRUE defaultet und darf
+|* nur beim errechnen von Tabellenzellen auf FALSE gesetzt
+|* werden, damit keine Rundungsfehler beim zusammenstellen
+|* der Formel entstehen.
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 19.02.98
+|*
+|******************************************************************************/
+
+String SwCalc::GetStrResult( const SwSbxValue& rVal, BOOL bRound )
+{
+ if( !rVal.IsDouble() )
+ return rVal.GetString();
+
+ return GetStrResult( rVal.GetDouble(), bRound );
+}
+
+
+String SwCalc::GetStrResult( double nValue, BOOL bRound )
+{
+ if( nValue >= DBL_MAX )
+ switch( eError )
+ {
+ case CALC_SYNTAX : return RESOURCE->aCalc_Syntax;
+ case CALC_ZERODIV : return RESOURCE->aCalc_ZeroDiv;
+ case CALC_BRACK : return RESOURCE->aCalc_Brack;
+ case CALC_POW : return RESOURCE->aCalc_Pow;
+ case CALC_VARNFND : return RESOURCE->aCalc_VarNFnd;
+ case CALC_OVERFLOW : return RESOURCE->aCalc_Overflow;
+ case CALC_WRONGTIME : return RESOURCE->aCalc_WrongTime;
+ default : return RESOURCE->aCalc_Default;
+ }
+
+ USHORT nDec = pInter->GetNumDigits();
+ String aRetStr;
+
+ SolarMath::DoubleToString( aRetStr, nValue,
+ 'A', /// 'F' 'E' 'G' 'A'
+ nDec, /// Nachkommastellen
+ pInter->GetNumDecimalSep(), /// Dezimalseparator
+ TRUE );
+
+#if 0
+ String aLast;
+ int nExp = 0,
+ nDigit,
+ nDecPos,
+ nDigits = nDec + 1;
+
+ if( !bRound )
+ nDigits = nDec = 14;
+
+ if( nValue < 0 )
+ {
+ nValue = -nValue;
+ aRetStr += '-';
+ }
+
+ if (nValue > 0 )
+ {
+ while( nValue < 1 )
+ nValue *= 10, --nExp;
+ while( nValue >= 10 )
+ nValue /= 10, ++nExp;
+ }
+ nDigits += nExp;
+ if( nDigits >= 0 &&
+ 9 < int( nValue += nRoundVal[ nDigits > 15 ? 15 : nDigits ] ))
+ {
+ nValue = 1;
+ nExp++;
+ nDigits++;
+ }
+
+ if( nExp < 0 )
+ {
+ int nPos;
+ if( pInter->IsNumLeadingZero() )
+ aRetStr += '0';
+ aRetStr += pInter->GetNumDecimalSep();
+ nPos = -nExp - 1;
+ if( nDigits <= 0 )
+ nPos = nDec;
+ while( nPos-- )
+ aRetStr += '0';
+ nDecPos = 0;
+ }
+ else
+ nDecPos = nExp + 1;
+ if( nDigits > 0 )
+ {
+ short nSep = nDecPos % 3;
+ BOOL bFirst = TRUE;
+ if( !nSep )
+ nSep = 3;
+ for( USHORT x = 0 ; ; x++ )
+ {
+ if( x < 15 )
+ {
+ if( 1 == nDigits && x && 14 > x )
+ nDigit = (int) floor( nValue + nKorrVal[ 15 - x ] );
+ else
+ nDigit = (int) ( nValue + 1E-15 );
+
+ if( 9 < nDigit )
+ {
+ ASSERT( !this, "Rundungsfehler" );
+ nDigit = 9;
+ }
+ if( bFirst )
+ aRetStr += (sal_Unicode) ( nDigit + '0' );
+ else
+ aLast += (sal_Unicode) ( nDigit + '0' );
+ nValue = ( nValue - nDigit ) * 10;
+ }
+ else
+ {
+ if( bFirst )
+ aRetStr += '0';
+ else
+ aLast += '0';
+ }
+ if(!--nDigits)
+ break;
+
+ if( nDecPos )
+ {
+ if( !--nDecPos )
+ bFirst = FALSE;
+ if( nDecPos && !--nSep && pInter->IsNumThousandSep() )
+ {
+ nSep = 3;
+ aRetStr += pInter->GetNumThousandSep();
+ }
+ }
+ }
+ }
+ if( 0L != aLast.ToInt32() )
+ {
+ aRetStr += pInter->GetNumDecimalSep();
+ aRetStr += aLast;
+ }
+#endif
+ return aRetStr;
+}
+
+/******************************************************************************
+ * Methode : BOOL SwCalc::ParseTime( USHORT *pHour, USHORT *pMin, USHORT *pSec )
+ * Beschreibung:
+ * Erstellt : OK 09.06.94 11:15
+ * Aenderung : JP 03.11.95
+ ******************************************************************************/
+
+enum TMStatus { TM_START, TM_THSEP, TM_MIN, TM_TMSEP, TM_SEC,
+ TM_AMPM, TM_END, TM_ERROR };
+
+BOOL SwCalc::ParseTime( USHORT *pHour, USHORT *pMin, USHORT *pSec )
+{
+ TimeFormat aTMFmt = pInter->GetTimeFormat();
+ sal_Unicode ch, cTMSep = pInter->GetTimeSep();
+
+ EatWhite( sCommand, nCommandPos );
+ ch = NextCh( sCommand, nCommandPos );
+
+ TMStatus eState = TM_START;
+ while( eState != TM_END && eState != TM_ERROR )
+ {
+ sal_Unicode cNext = 0;
+ USHORT *pActVal = 0;
+ switch( eState )
+ {
+ case TM_AMPM :
+ {
+ xub_StrLen nStt = --nCommandPos;
+ BOOL bFnd = FALSE;
+ String aStr;
+ const String& rPMStr = pInter->GetTimePM();
+ const String& rAMStr = pInter->GetTimeAM();
+ while( nCommandPos < sCommand.Len() )
+ {
+ EatWhite( sCommand, nCommandPos );
+ aStr += NextCh( sCommand, nCommandPos );
+ if( aStr == rPMStr )
+ {
+ if( *pHour <= 12 )
+ *pHour += 12;
+ bFnd =TRUE;
+ break;
+ }
+ if( aStr == rAMStr )
+ {
+ bFnd = TRUE;
+ break;
+ }
+ }
+ if( !bFnd )
+ nCommandPos = nStt;
+
+ // Klammer oder Trenner weglesen !
+ EatWhite( sCommand, nCommandPos );
+ ch = NextCh( sCommand, nCommandPos );
+ if( ch != ')' && ch != cListDelim )
+ eState = TM_ERROR;
+ else
+ eState = TM_END;
+ }
+ break;
+
+ case TM_TMSEP :
+ if( ch == cTMSep )
+ ++((int&)eState);
+ else
+ {
+ if( nCommandPos < sCommand.Len() )
+ --nCommandPos;
+ eState = TM_AMPM;
+ }
+ break;
+ case TM_THSEP :
+ if( ch == cTMSep )
+ ++((int&)eState);
+ else
+ {
+ if( nCommandPos < sCommand.Len() )
+ --nCommandPos;
+ eState = TM_AMPM;
+ }
+ break;
+
+ case TM_SEC : if( !pActVal ) pActVal = pSec;
+ case TM_MIN : if( !pActVal ) pActVal = pMin;
+ case TM_START :
+ {
+ if( ch == '(' || ch == cListDelim )
+ break;
+ if( !pActVal )
+ pActVal = pHour;
+
+ USHORT nVal = ( ch - '0' );
+ EatWhite( sCommand, nCommandPos );
+ cNext = NextCh( sCommand, nCommandPos );
+ if( cNext &&
+ pCharClass->isDigit( sCommand, nCommandPos - 1 ) )
+ {
+ if( eState != TM_START ||
+ aTMFmt == HOUR_12 && nVal <= 1 ||
+ aTMFmt == HOUR_24 && nVal <= 2 )
+ {
+ *pActVal = nVal * 10 + ( cNext - '0');
+ cNext = 0;
+ }
+ else
+ {
+ eState = TM_ERROR;
+ break;
+ }
+ }
+ else
+ *pActVal += nVal;
+ ++((int&)eState);
+ }
+ break;
+ }
+
+ if( eState != TM_END )
+ {
+ if( cNext )
+ ch = cNext;
+ else
+ {
+ EatWhite( sCommand, nCommandPos );
+ ch = NextCh( sCommand, nCommandPos );
+ }
+ }
+ }
+ return eState==TM_ERROR? FALSE : TRUE;
+}
+
+/******************************************************************************
+|*
+|* SwCalcExp* SwCalc::VarLook( const String& )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 15.11.99
+|*
+|******************************************************************************/
+
+SwCalcExp* SwCalc::VarInsert( const String &rStr )
+{
+ String aStr( rStr );
+ pCharClass->toLower( aStr );
+ return VarLook( aStr, 1 );
+}
+
+/******************************************************************************
+|*
+|* SwCalcExp* SwCalc::VarLook( const String& , USHORT ins )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 15.11.99
+|*
+|******************************************************************************/
+SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins )
+{
+ USHORT ii = 0;
+
+ SwHash* pFnd = Find( rStr, VarTable, TBLSZ, &ii );
+
+ if( !pFnd )
+ {
+ // dann sehen wir mal im Doc nach:
+ SwHash** ppDocTbl = rDoc.GetUpdtFlds().GetFldTypeTable();
+ for( SwHash* pEntry = *(ppDocTbl+ii); pEntry; pEntry = pEntry->pNext )
+ if( rStr == pEntry->aStr )
+ {
+ // dann hier zufuegen
+ pFnd = new SwCalcExp( rStr, SwSbxValue(),
+ ((SwCalcFldType*)pEntry)->pFldType );
+ pFnd->pNext = *(VarTable+ii);
+ *(VarTable+ii) = pFnd;
+ break;
+ }
+ }
+
+ if( pFnd )
+ {
+ SwCalcExp* pFndExp = (SwCalcExp*)pFnd;
+
+ if( pFndExp->pFldType && pFndExp->pFldType->Which() == RES_USERFLD )
+ {
+ SwUserFieldType* pUFld = (SwUserFieldType*)pFndExp->pFldType;
+ if( GSE_STRING & pUFld->GetType() )
+ pFndExp->nValue.PutString( pUFld->GetContent() );
+ else if( !pUFld->IsValid() )
+ {
+ // Die aktuellen Werte sichern . . .
+ USHORT nOld_ListPor = nListPor;
+ SwSbxValue nOld_LastLeft = nLastLeft;
+ SwSbxValue nOld_NumberValue = nNumberValue;
+ xub_StrLen nOld_CommandPos = nCommandPos;
+ SwCalcOper eOld_CurrOper = eCurrOper;
+ SwCalcOper eOld_CurrListOper = eCurrListOper;
+
+ pFndExp->nValue.PutDouble( pUFld->GetValue( *this ) );
+
+ // . . . und zurueck damit.
+ nListPor = nOld_ListPor;
+ nLastLeft = nOld_LastLeft;
+ nNumberValue = nOld_NumberValue;
+ nCommandPos = nOld_CommandPos;
+ eCurrOper = eOld_CurrOper;
+ eCurrListOper = eOld_CurrListOper;
+ }
+ else
+ pFndExp->nValue.PutDouble( pUFld->GetValue() );
+ }
+ return pFndExp;
+ }
+
+ // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
+ // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
+ String sTmpName( rStr );
+ ::ReplacePoint( sTmpName );
+
+ if( !ins )
+ {
+ SwNewDBMgr *pMgr = rDoc.GetNewDBMgr();
+
+ // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
+ // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
+#ifdef REPLACE_OFADBMGR
+ String sDBName(GetDBName( sTmpName ));
+ String sSourceName(sDBName.GetToken(0, DB_DELIM));
+ String sTableName(sDBName.GetToken(0).GetToken(1, DB_DELIM));
+ if( pMgr && sSourceName.Len() && sTableName.Len() &&
+ pMgr->OpenDataSource(sSourceName, sTableName))
+#else
+ String sDBName;
+ if( pMgr && ( sDBName = GetDBName( sTmpName )).Len() &&
+ pMgr->OpenDB( DBMGR_STD, sDBName, FALSE ))
+#endif
+ {
+ String sColumnName( GetColumnName( sTmpName ));
+ ASSERT (sColumnName.Len(), "DB-Spaltenname fehlt!");
+
+ String sDBNum( SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD) );
+ sDBNum.ToLowerAscii();
+
+ // Hier nochmal initialisieren, da das nicht mehr in docfld
+ // fuer Felder != RES_DBFLD geschieht. Z.B. wenn ein Expressionfield
+ // vor einem DB_Field in einem Dok vorkommt.
+#ifdef REPLACE_OFADBMGR
+ VarChange( sDBNum, pMgr->GetSelectedRecordId(sSourceName, sTableName));
+#else
+ VarChange( sDBNum, pMgr->GetCurSelectedRecordId(DBMGR_STD));
+#endif
+
+ if( sDBNum.EqualsIgnoreCaseAscii(sColumnName) )
+ {
+#ifdef REPLACE_OFADBMGR
+ aErrExpr.nValue.PutLong(long(pMgr->GetSelectedRecordId(sSourceName, sTableName)));
+#else
+ aErrExpr.nValue.PutLong(long(pMgr->GetCurSelectedRecordId(DBMGR_STD)));
+#endif
+ return &aErrExpr;
+ }
+
+ ULONG nTmpRec = 0;
+ if( 0 != ( pFnd = Find( sDBNum, VarTable, TBLSZ ) ) )
+ nTmpRec = ((SwCalcExp*)pFnd)->nValue.GetULong();
+
+ String sResult;
+ double nNumber = DBL_MAX;
+
+#ifdef REPLACE_OFADBMGR
+ const SfxPoolItem& rItem = rDoc.GetDefault(RES_CHRATR_LANGUAGE);
+ LanguageType eLang = ((SvxLanguageItem&)rDoc.GetDefault(
+ RES_CHRATR_LANGUAGE )).GetLanguage();
+ if(LANGUAGE_SYSTEM == eLang)
+ eLang = ::GetSystemLanguage();
+ if(pMgr->GetColumnCnt(sSourceName, sTableName, sColumnName, nTmpRec, (long)eLang, sResult, &nNumber))
+#else
+ if (pMgr->GetColumnCnt(DBMGR_STD, sColumnName,
+ pMgr->AbsToRel(DBMGR_STD, nTmpRec), sResult, &nNumber))
+#endif
+ {
+ if (nNumber != DBL_MAX)
+ aErrExpr.nValue.PutDouble( nNumber );
+ else
+ aErrExpr.nValue.PutString( sResult );
+
+ return &aErrExpr;
+ }
+ }
+ // auf keinen fall eintragen!!
+ return &aErrExpr;
+ }
+
+
+ SwCalcExp* pNewExp = new SwCalcExp( rStr, SwSbxValue(), 0 );
+ pNewExp->pNext = VarTable[ ii ];
+ VarTable[ ii ] = pNewExp;
+
+ String sColumnName( GetColumnName( sTmpName ));
+ ASSERT( sColumnName.Len(), "DB-Spaltenname fehlt!" );
+ if( sColumnName.EqualsIgnoreCaseAscii(
+ SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) ))
+ {
+ SwNewDBMgr *pMgr = rDoc.GetNewDBMgr();
+#ifdef REPLACE_OFADBMGR
+ String sDBName(GetDBName( sTmpName ));
+ String sSourceName(sDBName.GetToken(0, DB_DELIM));
+ String sTableName(sDBName.GetToken(0).GetToken(1, DB_DELIM));
+ if( pMgr && sSourceName.Len() && sTableName.Len() &&
+ pMgr->OpenDataSource(sSourceName, sTableName) &&
+ !pMgr->IsInMerge())
+ pNewExp->nValue.PutULong( pMgr->GetSelectedRecordId(sSourceName, sTableName));
+#else
+
+ if( pMgr && (sTmpName = GetDBName( sTmpName )).Len() &&
+ pMgr->OpenDB( DBMGR_STD, sTmpName, FALSE ) &&
+ !pMgr->IsInMerge() )
+ pNewExp->nValue.PutULong( pMgr->GetCurSelectedRecordId(DBMGR_STD) );
+#endif
+ }
+
+ return pNewExp;
+}
+
+/******************************************************************************
+|*
+|* BOOL SwCalc::VarChange( const String& rStr, const SwSbxValue nValue )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+void SwCalc::VarChange( const String& rStr, double nValue )
+{
+ SwSbxValue aVal( nValue );
+ VarChange( rStr, aVal );
+}
+
+void SwCalc::VarChange( const String& rStr, const SwSbxValue& rValue )
+{
+ String aStr( rStr );
+ pCharClass->toLower( aStr );
+
+ USHORT nPos = 0;
+ SwCalcExp* pFnd = (SwCalcExp*)Find( aStr, VarTable, TBLSZ, &nPos );
+
+ if( !pFnd )
+ {
+ pFnd = new SwCalcExp( aStr, SwSbxValue( rValue ), 0 );
+ pFnd->pNext = VarTable[ nPos ];
+ VarTable[ nPos ] = pFnd;
+ }
+ else
+ pFnd->nValue = rValue;
+}
+
+/******************************************************************************
+|*
+|* BOOL SwCalc::Push( const void* pPtr )
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung OK 12-02-93 11:05am
+|*
+|******************************************************************************/
+
+BOOL SwCalc::Push( const VoidPtr pPtr )
+{
+ if( USHRT_MAX != aRekurStk.GetPos( pPtr ) )
+ return FALSE;
+
+ aRekurStk.Insert( pPtr, aRekurStk.Count() );
+ return TRUE;
+}
+
+/******************************************************************************
+|*
+|* void SwCalc::Pop( const void* pPtr )
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung OK 12-02-93 11:05am
+|*
+|******************************************************************************/
+
+void SwCalc::Pop( const VoidPtr pPtr )
+{
+ ASSERT( aRekurStk.Count() && aRekurStk.GetPos( pPtr ) ==
+ (aRekurStk.Count() - 1 ), "SwCalc: Pop auf ungueltigen Ptr" );
+
+ aRekurStk.Remove( aRekurStk.Count() - 1 );
+}
+
+
+/******************************************************************************
+|*
+|* SwCalcOper SwCalc::GetToken()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+SwCalcOper SwCalc::GetToken()
+{
+ sal_Unicode ch;
+ sal_Unicode cTSep = pInter->GetNumThousandSep(),
+ cDSep = pInter->GetNumDecimalSep();
+
+ do {
+ if( 0 == ( ch = NextCh( sCommand, nCommandPos ) ) )
+ return eCurrOper = CALC_ENDCALC;
+ } while ( ch == '\t' || ch == ' ' || ch == cTSep );
+
+ if( ch == cDSep )
+ ch = '.';
+
+ switch( ch )
+ {
+ case ';':
+ case '\n': EatWhite( sCommand, nCommandPos );
+ eCurrOper = CALC_PRINT;
+ break;
+ case '%':
+ case '^':
+ case '*':
+ case '/':
+ case '+':
+ case '-':
+ case '(':
+ case ')': eCurrOper = SwCalcOper(ch);
+ break;
+
+ case '=': if( '=' == sCommand.GetChar( nCommandPos ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_EQ;
+ }
+ else
+ eCurrOper = SwCalcOper(ch);
+ break;
+
+ case '!': if( '=' == sCommand.GetChar( nCommandPos ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_NEQ;
+ }
+ else
+ eCurrOper = CALC_NOT;
+ break;
+
+ case '>':
+ case '<': eCurrOper = '>' == ch ? CALC_GRE : CALC_LES;
+ if( '=' == (ch = sCommand.GetChar( nCommandPos ) ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_GRE == eCurrOper ? CALC_GEQ : CALC_LEQ;
+ }
+ else if( ' ' != ch )
+ {
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ break;
+
+ case cListDelim :
+ eCurrOper = eCurrListOper;
+ break;
+
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case ',':
+ case '.': {
+ double nVal;
+ --nCommandPos; // auf das 1. Zeichen zurueck
+ if( Str2Double( sCommand, nCommandPos, nVal, pInter ))
+ {
+ nNumberValue.PutDouble( nVal );
+ eCurrOper = CALC_NUMBER;
+ }
+ else
+ {
+ // fehlerhafte Zahl
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ }
+ break;
+
+ case '[': {
+ String aStr;
+ BOOL bIgnore = FALSE;
+ do {
+ while( ( ch = NextCh( sCommand, nCommandPos ))
+ && ch != ']' )
+ {
+ if( !bIgnore && '\\' == ch )
+ bIgnore = TRUE;
+ else if( bIgnore )
+ bIgnore = FALSE;
+ aStr += ch;
+ }
+
+ if( !bIgnore )
+ break;
+
+ aStr.SetChar( aStr.Len() - 1, ch );
+ } while( ch );
+
+ aVarName = aStr;
+ eCurrOper = CALC_NAME;
+ }
+ break;
+
+ case '"': {
+ xub_StrLen nStt = nCommandPos;
+ while( ( ch = NextCh( sCommand, nCommandPos ))
+ && '"' != ch )
+ ;
+
+ xub_StrLen nLen = nCommandPos - nStt;
+ if( '"' == ch )
+ --nLen;
+ nNumberValue.PutString( sCommand.Copy( nStt, nLen ));
+ eCurrOper = CALC_NUMBER;
+ }
+ break;
+
+ default: if( ch && pCharClass->isLetter( sCommand, nCommandPos - 1)
+ || '_' == ch )
+ {
+ xub_StrLen nStt = nCommandPos-1;
+ while( 0 != (ch = NextCh( sCommand, nCommandPos )) &&
+ (pCharClass->isLetterNumeric(
+ sCommand, nCommandPos - 1) ||
+ ch == '_' || ch == '.' ) )
+ ;
+
+ if( nCommandPos < sCommand.Len() )
+ --nCommandPos;
+
+ String aStr( sCommand.Copy( nStt, nCommandPos-nStt ));
+ pCharClass->toLower( aStr );
+
+
+ // Currency-Symbol abfangen
+ if( aStr == sCurrSym )
+ return GetToken(); // also nochmal aufrufen
+
+ // Operations abfangen
+ _CalcOp* pFnd = ::FindOperator( aStr );
+ if( pFnd )
+ {
+ switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
+ {
+ case CALC_SUM :
+ case CALC_MEAN : eCurrListOper = CALC_PLUS;
+ break;
+ case CALC_MIN : eCurrListOper = CALC_MIN_IN;
+ break;
+ case CALC_MAX : eCurrListOper = CALC_MAX_IN;
+ break;
+ }
+ return eCurrOper;
+ }
+ aVarName = aStr;
+ eCurrOper = CALC_NAME;
+ }
+ else
+ {
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ break;
+ }
+ return eCurrOper;
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Term()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 16.01.96
+|*
+|******************************************************************************/
+
+SwSbxValue SwCalc::Term()
+{
+ SwSbxValue left( Prim() );
+ nLastLeft = left;
+ for(;;)
+ {
+ SbxOperator eSbxOper = (SbxOperator)USHRT_MAX;
+
+ switch( eCurrOper )
+ {
+// wir haben kein Bitweises verodern, oder ?
+// case CALC_AND: eSbxOper = SbxAND; break;
+// case CALC_OR: eSbxOper = SbxOR; break;
+// case CALC_XOR: eSbxOper = SbxXOR; break;
+ case CALC_AND: {
+ GetToken();
+ BOOL bB = Prim().GetBool();
+ left.PutBool( left.GetBool() && bB );
+ }
+ break;
+ case CALC_OR: {
+ GetToken();
+ BOOL bB = Prim().GetBool();
+ left.PutBool( left.GetBool() || bB );
+ }
+ break;
+ case CALC_XOR: {
+ GetToken();
+ BOOL bR = Prim().GetBool();
+ BOOL bL = left.GetBool();
+ left.PutBool( (bL && !bR) || (!bL && bR) );
+ }
+ break;
+
+ case CALC_EQ: eSbxOper = SbxEQ; break;
+ case CALC_NEQ: eSbxOper = SbxNE; break;
+ case CALC_LEQ: eSbxOper = SbxLE; break;
+ case CALC_GEQ: eSbxOper = SbxGE; break;
+ case CALC_GRE: eSbxOper = SbxGT; break;
+ case CALC_LES: eSbxOper = SbxLT; break;
+
+ case CALC_MUL: eSbxOper = SbxMUL; break;
+ case CALC_DIV: eSbxOper = SbxDIV; break;
+
+ case CALC_MIN_IN:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ left = left.GetDouble() < e.GetDouble()
+ ? left : e;
+ }
+ break;
+ case CALC_MAX_IN:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ left = left.GetDouble() > e.GetDouble()
+ ? left : e;
+ }
+ break;
+ case CALC_ROUND:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+
+ double fVal = 0;
+ double fFac = 1;
+ INT32 nDec = (INT32) floor( e.GetDouble() );
+ if( nDec < -20 || nDec > 20 )
+ {
+ eError = CALC_OVERFLOW;
+ left.Clear();
+ return left;
+ }
+ fVal = left.GetDouble();
+ USHORT i;
+ if( nDec >= 0)
+ for (i = 0; i < (USHORT) nDec; ++i )
+ fFac *= 10.0;
+ else
+ for (i = 0; i < (USHORT) -nDec; ++i )
+ fFac /= 10.0;
+
+ fVal *= fFac;
+
+ BOOL bSign;
+ if (fVal < 0.0)
+ {
+ fVal *= -1.0;
+ bSign = TRUE;
+ }
+ else
+ bSign = FALSE;
+
+ // runden
+ double fNum = fVal; // find the exponent
+ int nExp = 0;
+ if( fNum > 0 )
+ {
+ while( fNum < 1.0 ) fNum *= 10.0, --nExp;
+ while( fNum >= 10.0 ) fNum /= 10.0, ++nExp;
+ }
+ nExp = 15 - nExp;
+ if( nExp > 15 )
+ nExp = 15;
+ else if( nExp <= 1 )
+ nExp = 0;
+ fVal = floor( fVal+ 0.5 + nRoundVal[ nExp ] );
+
+ if (bSign)
+ fVal *= -1.0;
+
+ fVal /= fFac;
+
+ left.PutDouble( fVal );
+ }
+ break;
+
+ /* case CALC_POW: {
+ GetToken();
+#if defined(MAC) && !defined(__powerc)
+ long double fraction, integer;
+#else
+ double fraction, integer;
+#endif
+ double right = Prim().GetDouble(),
+ dleft = left.GetDouble();
+
+ fraction = modf( right, &integer );
+ if( ( dleft < 0.0 && 0.0 != fraction ) ||
+ ( 0.0 == dleft && right < 0.0 ) )
+ {
+ eError = CALC_OVERFLOW;
+ left.Clear();
+ return left;
+ }
+ dleft = pow(dleft, right );
+ if( dleft == HUGE_VAL )
+ {
+ eError = CALC_POWERR;
+ left.Clear();
+ return left;
+ }
+ left.PutDouble( dleft );
+ }
+ break;
+*/
+ default: return left;
+ }
+
+ if( USHRT_MAX != (USHORT)eSbxOper )
+ {
+ GetToken();
+ if( SbxEQ <= eSbxOper && eSbxOper <= SbxGE )
+ left.PutBool( left.Compare( eSbxOper, Prim() ));
+ else
+ {
+ SwSbxValue aRight( Prim() );
+ aRight.MakeDouble();
+ left.MakeDouble();
+
+ if( SbxDIV == eSbxOper && !aRight.GetDouble() )
+ eError = CALC_ZERODIV;
+ else
+ left.Compute( eSbxOper, aRight );
+ }
+ }
+ }
+ left.Clear();
+ return left;
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Prim()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+SwSbxValue SwCalc::Prim()
+{
+ SwSbxValue nErg;
+
+ double (
+#ifdef WNT
+ __cdecl
+#endif
+
+#ifdef OS2
+ _Optlink
+#endif
+ *pFnc)( double ) = 0;
+
+ BOOL bChkTrig = FALSE, bChkPow = FALSE;
+
+ switch( eCurrOper )
+ {
+ case CALC_SIN: pFnc = &sin; break;
+ case CALC_COS: pFnc = &cos; break;
+ case CALC_TAN: pFnc = &tan; break;
+ case CALC_ATAN: pFnc = &atan; break;
+ case CALC_ASIN: pFnc = &asin; bChkTrig = TRUE; break;
+ case CALC_ACOS: pFnc = &acos; bChkTrig = TRUE; break;
+
+ case CALC_NOT: {
+ GetToken();
+ nErg = Prim();
+ if( SbxSTRING == nErg.GetType() )
+ nErg.PutBool( 0 != nErg.GetString().Len() );
+ nErg.Compute( SbxNOT, nErg );
+ }
+ break;
+
+ case CALC_NUMBER: if( GetToken() == CALC_PHD )
+ {
+ double aTmp = nLastLeft.GetDouble();
+ aTmp *= nNumberValue.GetDouble();
+ aTmp *= 0.01;
+ nErg.PutDouble( aTmp );
+ GetToken();
+ }
+ else if( eCurrOper == CALC_NAME )
+ eError = CALC_SYNTAX;
+ else
+ {
+ nErg = nNumberValue;
+ bChkPow = TRUE;
+ }
+ break;
+
+ case CALC_NAME: if( GetToken() == CALC_ASSIGN )
+ {
+ SwCalcExp* n = VarInsert( aVarName );
+ GetToken();
+ nErg = n->nValue = Expr();
+ }
+ else
+ {
+ nErg = VarLook( aVarName )->nValue;
+ bChkPow = TRUE;
+ }
+ break;
+
+ case CALC_MINUS: GetToken();
+ nErg.PutDouble( -(Prim().GetDouble()) );
+ break;
+
+ case CALC_LP: {
+ GetToken();
+ nErg = Expr();
+ if( eCurrOper != CALC_RP )
+ eError = CALC_BRACK;
+ else
+ GetToken();
+ }
+ break;
+
+ case CALC_TDIF: {
+ USHORT nH1 = 0, nM1 = 0, nS1 = 0,
+ nH2 = 0, nM2 = 0, nS2 = 0;
+ if( !ParseTime( &nH1, &nM1, &nS1 ) ||
+ !ParseTime( &nH2, &nM2, &nS2 ) )
+ eError = CALC_WRONGTIME;
+ GetToken();
+ nErg.PutDouble( double(
+ 3600L * nH2 + 60 * nM2 + nS2 -
+ 3600L * nH1 - 60 * nM1 - nS1 ));
+ }
+ break;
+
+ case CALC_MEAN: {
+ nListPor = 1;
+ GetToken();
+ nErg = Expr();
+ double aTmp = nErg.GetDouble();
+ aTmp /= nListPor;
+ nErg.PutDouble( aTmp );
+ }
+ break;
+
+ case CALC_SQRT: {
+ GetToken();
+ nErg = Prim();
+ if( nErg.GetDouble() < 0 )
+ eError = CALC_OVERFLOW;
+ else
+ nErg.PutDouble( sqrt( nErg.GetDouble() ));
+ }
+ break;
+
+ case CALC_SUM:
+ case CALC_MIN:
+ case CALC_MAX: GetToken();
+ nErg = Expr();
+ break;
+
+ case CALC_ENDCALC: nErg.Clear();
+ break;
+
+ default: eError = CALC_SYNTAX;
+ break;
+ }
+
+ if( pFnc )
+ {
+ GetToken();
+ double nVal = Prim().GetDouble();
+ if( !bChkTrig || ( nVal > -1 && nVal < 1 ) )
+ nErg.PutDouble( (*pFnc)( nVal ) );
+ else
+ eError = CALC_OVERFLOW;
+ }
+
+ if( bChkPow && eCurrOper == CALC_POW )
+ {
+ double dleft = nErg.GetDouble();
+ GetToken();
+ double right = Prim().GetDouble();
+
+#if defined(MAC) && !defined(__powerc)
+ long double fraction, integer;
+#else
+ double fraction, integer;
+#endif
+ fraction = modf( right, &integer );
+ if( ( dleft < 0.0 && 0.0 != fraction ) ||
+ ( 0.0 == dleft && right < 0.0 ) )
+ {
+ eError = CALC_OVERFLOW;
+ nErg.Clear();
+ }
+ else
+ {
+ dleft = pow(dleft, right );
+ if( dleft == HUGE_VAL )
+ {
+ eError = CALC_POWERR;
+ nErg.Clear();
+ }
+ else
+ {
+ nErg.PutDouble( dleft );
+// GetToken();
+ }
+ }
+ }
+
+ return nErg;
+}
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Expr()
+|*
+|* Erstellung OK 12-02-93 11:06am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+SwSbxValue SwCalc::Expr()
+{
+ SwSbxValue left = Term(), right;
+ nLastLeft = left;
+ for(;;)
+ switch(eCurrOper)
+ {
+ case CALC_PLUS: GetToken();
+ // erzeuge zum addieren auf jedenfall einen
+ // Double-Wert
+ left.MakeDouble();
+ ( right = Term() ).MakeDouble();
+ left.Compute( SbxPLUS, right );
+ nListPor++;
+ break;
+
+ case CALC_MINUS: GetToken();
+ // erzeuge zum addieren auf jedenfall einen
+ // Double-Wert
+ left.MakeDouble();
+ ( right = Term() ).MakeDouble();
+ left.Compute( SbxMINUS, right );
+ break;
+
+ default: return left;
+ }
+ left.Clear();
+ return left;
+}
+
+//------------------------------------------------------------------------------
+
+String SwCalc::GetColumnName(const String& rName)
+{
+ xub_StrLen nPos = rName.Search(DB_DELIM);
+ if( STRING_NOTFOUND != nPos )
+ {
+ nPos = rName.Search(DB_DELIM, nPos + 1);
+
+ if( STRING_NOTFOUND != nPos )
+ return rName.Copy(nPos + 1);
+ }
+ return rName;
+}
+
+//------------------------------------------------------------------------------
+
+String SwCalc::GetDBName(const String& rName)
+{
+ xub_StrLen nPos = rName.Search(DB_DELIM);
+ if( STRING_NOTFOUND != nPos )
+ {
+ nPos = rName.Search(DB_DELIM, nPos + 1);
+
+ if( STRING_NOTFOUND != nPos )
+ return rName.Copy( 0, nPos );
+ }
+ return rDoc.GetDBName();
+}
+
+//------------------------------------------------------------------------------
+
+/******************************************************************************
+ * Methode : FASTBOOL SwCalc::Str2Double( double& )
+ * Beschreibung:
+ * Erstellt : OK 07.06.94 12:56
+ * Aenderung : JP 27.10.98
+ ******************************************************************************/
+FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ double& rVal, const International* pInter )
+{
+ const International* pIntr = pInter;
+ if( !pIntr )
+ {
+ pIntr = &Application::GetAppInternational();
+ if( pIntr->GetFormatLanguage() != System::GetLanguage() )
+ pIntr = new International( System::GetLanguage() );
+ }
+
+ const xub_Unicode* pEnd;
+ int nErrno;
+ rVal = SolarMath::StringToDouble( rCommand.GetBuffer() + rCommandPos,
+ pIntr->GetNumThousandSep(),
+ pIntr->GetNumDecimalSep(),
+ nErrno, &pEnd );
+ rCommandPos = pEnd - rCommand.GetBuffer();
+
+ if( !pInter && pIntr != &Application::GetAppInternational() )
+ delete (International*)pIntr;
+
+ return 0 == nErrno;
+}
+
+//------------------------------------------------------------------------------
+
+/******************************************************************************
+|*
+|* CTOR DTOR der SwHash classes
+|*
+|* Ersterstellung OK 25.06.93 12:20
+|* Letzte Aenderung OK 25.06.93 12:20
+|*
+******************************************************************************/
+
+SwHash::SwHash( const String& rStr ) :
+ aStr( rStr ),
+ pNext( 0 )
+{}
+
+SwHash::~SwHash()
+{
+ if( pNext )
+ delete pNext;
+}
+
+void DeleteHashTable( SwHash **ppHashTable, USHORT nCount )
+{
+ for ( USHORT i = 0; i < nCount; ++i )
+ delete *(ppHashTable+i);
+ __DELETE(nCount) ppHashTable;
+}
+
+SwCalcExp::SwCalcExp( const String& rStr, const SwSbxValue& rVal,
+ const SwFieldType* pType )
+ : SwHash( rStr ),
+ nValue( rVal ),
+ pFldType( pType )
+{
+}
+
+
+SwSbxValue::~SwSbxValue()
+{
+}
+
+
+BOOL SwSbxValue::GetBool() const
+{
+ return SbxSTRING == GetType() ? 0 != GetString().Len()
+ : SbxValue::GetBool();
+}
+
+double SwSbxValue::GetDouble() const
+{
+ double nRet;
+ if( SbxSTRING == GetType() )
+ {
+ xub_StrLen nStt = 0;
+ SwCalc::Str2Double( GetString(), nStt, nRet );
+ }
+ else
+ nRet = SbxValue::GetDouble();
+ return nRet;
+}
+
+SwSbxValue& SwSbxValue::MakeDouble()
+{
+ if( SbxSTRING == GetType() )
+ PutDouble( GetDouble() );
+ return *this;
+}
+
+#ifdef STANDALONE_HASHCALC
+
+// dies ist der Beispielcode zu erzeugen der HashValues im CTOR:
+
+#include
+
+void main()
+{
+static sal_Char
+ sNType0[] = "false", sNType1[] = "true", sNType2[] = "pi",
+ sNType3[] = "e", sNType4[] = "tables", sNType5[] = "graf",
+ sNType6[] = "ole", sNType7[] = "page", sNType8[] = "para",
+ sNType9[] = "word", sNType10[]= "char",
+ sNType11[] = "user_company" , sNType12[] = "user_firstname" ,
+ sNType13[] = "user_lastname" , sNType14[] = "user_initials",
+ sNType15[] = "user_street" , sNType16[] = "user_country" ,
+ sNType17[] = "user_zipcode" , sNType18[] = "user_city" ,
+ sNType19[] = "user_title" , sNType20[] = "user_position" ,
+ sNType21[] = "user_tel_home", sNType22[] = "user_tel_work",
+ sNType23[] = "user_fax" , sNType24[] = "user_email" ,
+ sNType25[] = "user_state", sNType26[] = "graph"
+ ;
+
+static const sal_Char* sNTypeTab[ 27 ] =
+{
+ sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
+ sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
+ sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
+ sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
+ sNType24, sNType25, sNType26
+};
+
+ const unsigned short nTblSize = 47;
+ int aArr[ nTblSize ] = { 0 };
+ sal_Char ch;
+
+ for( int n = 0; n < 27; ++n )
+ {
+ unsigned long ii = 0;
+ const sal_Char* pp = sNTypeTab[ n ];
+
+ while( *pp )
+ ii = ii << 1 ^ *pp++;
+ ii %= nTblSize;
+
+ ch = aArr[ ii ] ? 'X' : ' ';
+ aArr[ ii ] = 1;
+ printf( "%-20s -> %3d [%c]\n", sNTypeTab[ n ], ii, ch );
+ }
+}
+
+#endif
+
+
+
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
new file mode 100644
index 000000000000..9a7f6017b104
--- /dev/null
+++ b/sw/source/core/bastyp/index.cxx
@@ -0,0 +1,772 @@
+/*************************************************************************
+ *
+ * $RCSfile: index.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include // fuer qsort
+
+#ifndef _SOLAR_H
+#include
+#endif
+
+#include "errhdl.hxx" // fuers ASSERT
+#include "index.hxx"
+#include "error.h" // fuers ASSERT
+
+#ifndef PRODUCT
+int SwIndex::nSerial = 0;
+#endif
+
+
+TYPEINIT0(SwIndexReg); // rtti
+
+
+#ifdef CHK
+
+#define IDX_CHK_ARRAY pArray->ChhkArr();
+#define ARR_CHK_ARRAY ChhkArr();
+
+
+void SwIndexReg::ChkArr()
+{
+ ASSERT( (pFirst && pLast) || (!pFirst && !pLast),
+ "Array falsch Indiziert" );
+
+ if( !pFirst )
+ return;
+
+ xub_StrLen nVal = 0;
+ const SwIndex* pIdx = pFirst, *pPrev = 0;
+ ASSERT( !pIdx->pPrev, "Array-pFirst nicht am Anfang" );
+
+ while( pIdx != pLast )
+ {
+ ASSERT( pIdx->pPrev != pIdx && pIdx->pNext != pIdx,
+ "Index zeigt auf sich selbst" )
+
+ ASSERT( pIdx->nIndex >= nVal, "Reihenfolge stimmt nicht" );
+ ASSERT( pPrev == pIdx->pPrev, "Verkettung stimmt nicht" );
+ pPrev = pIdx;
+ pIdx = pIdx->pNext;
+ nVal = pPrev->nIndex;
+ }
+}
+
+#else // CHK
+
+#define IDX_CHK_ARRAY
+#define ARR_CHK_ARRAY
+
+#endif // CHK
+
+
+
+SwIndex::SwIndex( SwIndexReg* pArr, xub_StrLen nIdx )
+ : pArray( pArr ), nIndex( nIdx ), pNext( 0 ), pPrev( 0 )
+{
+ if( !pArray )
+ {
+ pArray = SwIndexReg::pEmptyIndexArray;
+ nIndex = 0; // steht immer auf 0 !!!
+ }
+
+ if( !pArray->pFirst ) // 1. Index ??
+ pArray->pFirst = pArray->pLast = this;
+ else if( pArray->pMiddle )
+ {
+ if( pArray->pMiddle->nIndex <= nIdx )
+ {
+ if( nIdx > ((pArray->pLast->nIndex - pArray->pMiddle->nIndex) / 2) )
+ ChgValue( *pArray->pLast, nIdx );
+ else
+ ChgValue( *pArray->pMiddle, nIdx );
+ }
+ else if( nIdx > ((pArray->pMiddle->nIndex - pArray->pFirst->nIndex) / 2) )
+ ChgValue( *pArray->pMiddle, nIdx );
+ else
+ ChgValue( *pArray->pFirst, nIdx );
+ }
+ else if( nIdx > ((pArray->pLast->nIndex - pArray->pFirst->nIndex) / 2) )
+ ChgValue( *pArray->pLast, nIdx );
+ else
+ ChgValue( *pArray->pFirst, nIdx );
+
+#ifndef PRODUCT
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+IDX_CHK_ARRAY
+}
+
+
+SwIndex::SwIndex( const SwIndex& rIdx, short nIdx )
+ : pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 )
+{
+ ChgValue( rIdx, rIdx.nIndex + nIdx );
+
+#ifndef PRODUCT
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+IDX_CHK_ARRAY
+}
+
+
+SwIndex::SwIndex( const SwIndex& rIdx )
+ : pArray( rIdx.pArray ), nIndex( rIdx.nIndex ), pNext( 0 ), pPrev( 0 )
+{
+ ChgValue( rIdx, rIdx.nIndex );
+#ifndef PRODUCT
+ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+#endif
+IDX_CHK_ARRAY
+}
+
+
+SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
+{
+ register SwIndex* pFnd = (SwIndex*)&rIdx;
+ if( rIdx.nIndex > nNewValue ) // nach vorne versuchen
+ {
+ register SwIndex* pPrv;
+ while( 0 != ( pPrv = pFnd->pPrev ) && pPrv->nIndex > nNewValue )
+ pFnd = pPrv;
+
+ if( pFnd != this )
+ {
+ // an alter Position ausketten
+ // erstmal an alter Position ausketten
+ if( pPrev )
+ pPrev->pNext = pNext;
+ else if( pArray->pFirst == this )
+ pArray->pFirst = pNext;
+
+ if( pNext )
+ pNext->pPrev = pPrev;
+ else if( pArray->pLast == this )
+ pArray->pLast = pPrev;
+
+ pNext = pFnd;
+ pPrev = pFnd->pPrev;
+ if( pPrev )
+ pPrev->pNext = this;
+ else
+ pArray->pFirst = this;
+ pFnd->pPrev = this;
+ }
+ }
+ else if( rIdx.nIndex < nNewValue )
+ {
+ register SwIndex* pNxt;
+ while( 0 != ( pNxt = pFnd->pNext ) && pNxt->nIndex < nNewValue )
+ pFnd = pNxt;
+
+ if( pFnd != this )
+ {
+ // erstmal an alter Position ausketten
+ if( pPrev )
+ pPrev->pNext = pNext;
+ else if( pArray->pFirst == this )
+ pArray->pFirst = pNext;
+
+ if( pNext )
+ pNext->pPrev = pPrev;
+ else if( pArray->pLast == this )
+ pArray->pLast = pPrev;
+
+ pPrev = pFnd;
+ pNext = pFnd->pNext;
+ if( pNext )
+ pNext->pPrev = this;
+ else
+ pArray->pLast = this;
+ pFnd->pNext = this;
+ }
+ }
+ else if( pFnd != this )
+ {
+ // erstmal an alter Position ausketten
+ if( pPrev )
+ pPrev->pNext = pNext;
+ else if( pArray->pFirst == this )
+ pArray->pFirst = pNext;
+
+ if( pNext )
+ pNext->pPrev = pPrev;
+ else if( pArray->pLast == this )
+ pArray->pLast = pPrev;
+
+ pPrev = (SwIndex*)&rIdx;
+ pNext = rIdx.pNext;
+ pPrev->pNext = this;
+
+ if( !pNext ) // im IndexArray als letzes
+ pArray->pLast = this;
+ else
+ pNext->pPrev = this;
+ }
+ pArray = rIdx.pArray;
+
+ if( pArray->pFirst == pNext )
+ pArray->pFirst = this;
+ if( pArray->pLast == pPrev )
+ pArray->pLast = this;
+
+ nIndex = nNewValue;
+
+IDX_CHK_ARRAY
+
+ return *this; }
+
+
+void SwIndex::Remove()
+{
+ if( !pPrev )
+ pArray->pFirst = pNext;
+ else
+ pPrev->pNext = pNext;
+
+ if( !pNext )
+ pArray->pLast = pPrev;
+ else
+ pNext->pPrev = pPrev;
+
+ if( this == pArray->pMiddle ) pArray->pMiddle = pPrev;
+IDX_CHK_ARRAY
+}
+
+/*************************************************************************
+|*
+|* SwIndex & SwIndex::operator=( const SwIndex & aSwIndex )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+SwIndex& SwIndex::operator=( const SwIndex& rIdx )
+{
+ int bEqual;
+ if( rIdx.pArray != pArray ) // im alten abmelden !!
+ {
+ Remove();
+ pArray = rIdx.pArray;
+ pNext = pPrev = 0;
+ bEqual = FALSE;
+ }
+ else
+ bEqual = rIdx.nIndex == nIndex;
+
+ if( !bEqual )
+ ChgValue( rIdx, rIdx.nIndex );
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* SwIndex &SwIndex::Assign
+|*
+|* Beschreibung
+|* Ersterstellung VB 25.03.91
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
+{
+ if( !pArr )
+ {
+ pArr = SwIndexReg::pEmptyIndexArray;
+ nIdx = 0; // steht immer auf 0 !!!
+ }
+
+ if( pArr != pArray ) // im alten abmelden !!
+ {
+ Remove();
+ pArray = pArr;
+ pNext = pPrev = 0;
+ if( !pArr->pFirst ) // 1. Index ??
+ {
+ pArr->pFirst = pArr->pLast = this;
+ nIndex = nIdx;
+ }
+ else if( pArray->pMiddle )
+ {
+ if( pArray->pMiddle->nIndex <= nIdx )
+ {
+ if( nIdx > ((pArr->pLast->nIndex - pArr->pMiddle->nIndex) / 2) )
+ ChgValue( *pArr->pLast, nIdx );
+ else
+ ChgValue( *pArr->pMiddle, nIdx );
+ }
+ else if( nIdx > ((pArr->pMiddle->nIndex - pArr->pFirst->nIndex) / 2) )
+ ChgValue( *pArr->pMiddle, nIdx );
+ else
+ ChgValue( *pArr->pFirst, nIdx );
+ }
+ else if( nIdx > ((pArr->pLast->nIndex - pArr->pFirst->nIndex) / 2) )
+ ChgValue( *pArr->pLast, nIdx );
+ else
+ ChgValue( *pArr->pFirst, nIdx );
+ }
+ else if( nIndex != nIdx )
+ ChgValue( *this, nIdx );
+IDX_CHK_ARRAY
+ return *this;
+}
+
+
+SwIndexReg::SwIndexReg()
+ : pFirst( 0 ), pLast( 0 ), pMiddle( 0 )
+{
+}
+
+#ifndef PRODUCT
+
+
+SwIndexReg::~SwIndexReg()
+{
+ ASSERT( !pFirst || !pLast, "Es sind noch Indizies angemeldet" );
+}
+
+#endif
+
+
+void SwIndexReg::Update( const SwIndex& rIdx, xub_StrLen nDiff, BOOL bNeg )
+{
+ register SwIndex* pStt = (SwIndex*)&rIdx;
+ register xub_StrLen nNewVal = rIdx.nIndex;
+ if( bNeg )
+ {
+ register xub_StrLen nLast = rIdx.GetIndex() + nDiff;
+ while( pStt && pStt->nIndex == nNewVal )
+ {
+ pStt->nIndex = nNewVal;
+ pStt = pStt->pPrev;
+ }
+ pStt = rIdx.pNext;
+ while( pStt && pStt->nIndex >= nNewVal &&
+ pStt->nIndex <= nLast )
+ {
+ pStt->nIndex = nNewVal;
+ pStt = pStt->pNext;
+ }
+ while( pStt )
+ {
+ pStt->nIndex -= nDiff;
+ pStt = pStt->pNext;
+ }
+ }
+ else
+ {
+ while( pStt && pStt->nIndex == nNewVal )
+ {
+ pStt->nIndex += nDiff;
+ pStt = pStt->pPrev;
+ }
+ pStt = rIdx.pNext;
+ while( pStt )
+ {
+ pStt->nIndex += nDiff;
+ pStt = pStt->pNext;
+ }
+ }
+ARR_CHK_ARRAY
+}
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator++()
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+#ifndef PRODUCT
+
+#ifndef CFRONT
+
+
+xub_StrLen SwIndex::operator++(int)
+{
+ ASSERT_ID( nIndex < INVALID_INDEX, ERR_OUTOFSCOPE );
+
+ xub_StrLen nOldIndex = nIndex;
+ ChgValue( *this, nIndex+1 );
+ return nOldIndex;
+}
+
+#endif
+
+
+xub_StrLen SwIndex::operator++()
+{
+ ASSERT_ID( nIndex < INVALID_INDEX, ERR_OUTOFSCOPE );
+
+ ChgValue( *this, nIndex+1 );
+ return nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator--()
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+#ifndef CFRONT
+
+
+xub_StrLen SwIndex::operator--(int)
+{
+ ASSERT_ID( nIndex, ERR_OUTOFSCOPE );
+
+ xub_StrLen nOldIndex = nIndex;
+ ChgValue( *this, nIndex-1 );
+ return nOldIndex;
+}
+
+#endif
+
+
+xub_StrLen SwIndex::operator--()
+{
+ ASSERT_ID( nIndex, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex-1 ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator+=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+xub_StrLen SwIndex::operator+=( xub_StrLen nWert )
+{
+ ASSERT_ID( nIndex < INVALID_INDEX - nWert, ERR_OUTOFSCOPE);
+ return ChgValue( *this, nIndex + nWert ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator-=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+xub_StrLen SwIndex::operator-=( xub_StrLen nWert )
+{
+ ASSERT_ID( nIndex >= nWert, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex - nWert ).nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator+=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+xub_StrLen SwIndex::operator+=( const SwIndex & rIndex )
+{
+ ASSERT_ID( nIndex < INVALID_INDEX - rIndex.nIndex, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex + rIndex.nIndex ).nIndex;
+}
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator-=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+xub_StrLen SwIndex::operator-=( const SwIndex & rIndex )
+{
+ ASSERT_ID( nIndex >= rIndex.nIndex, ERR_OUTOFSCOPE );
+ return ChgValue( *this, nIndex - rIndex.nIndex ).nIndex;
+}
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator<( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+BOOL SwIndex::operator<( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex < rIndex.nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator<=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+
+BOOL SwIndex::operator<=( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex <= rIndex.nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator>( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+
+BOOL SwIndex::operator>( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex > rIndex.nIndex;
+}
+
+/*************************************************************************
+|*
+|* SwIndex::operator>=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+
+BOOL SwIndex::operator>=( const SwIndex & rIndex ) const
+{
+ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+ return nIndex >= rIndex.nIndex;
+}
+
+#endif
+
+/*************************************************************************
+|*
+|* SwIndex & SwIndex::operator=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 10.12.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+#ifndef PRODUCT
+
+
+SwIndex& SwIndex::operator=( xub_StrLen nWert )
+{
+ // Werte kopieren und im neuen Array anmelden
+ if( nIndex != nWert )
+ ChgValue( *this, nWert );
+
+ return *this;
+}
+
+#endif
+
+
+
+void SwIndexReg::MoveIdx( const SwIndex& rOldPos, const SwIndex& rNewPos )
+{
+ ASSERT( rOldPos.pArray == rNewPos.pArray,
+ "stehen in unterschiedlichen Arrays" );
+
+ SwIndex* pStt = (SwIndex*)&rOldPos, *pEnd = pStt;
+ SwIndex* pInsPos = (SwIndex*)&rNewPos;
+ xub_StrLen nOldIndex = rOldPos.nIndex,
+ nNewIndex = rNewPos.nIndex;
+
+ if( nOldIndex == nNewIndex )
+ return;
+
+ while( pInsPos->pPrev && pInsPos->pPrev->nIndex == nNewIndex )
+ pInsPos = pInsPos->pPrev;
+
+ if( nNewIndex > nOldIndex )
+ --nNewIndex;
+
+ while( pStt->pPrev && pStt->pPrev->nIndex == nOldIndex )
+ {
+ pStt = pStt->pPrev;
+ pStt->nIndex = nNewIndex;
+ }
+ while( pEnd->pNext && pEnd->pNext->nIndex == nOldIndex )
+ {
+ pEnd = pEnd->pNext;
+ pEnd->nIndex = nNewIndex;
+ }
+
+ {
+ for( SwIndex* pTmp = pStt; pTmp != pEnd; pTmp = pTmp->pNext )
+ pTmp->nIndex = nNewIndex;
+ pTmp->nIndex = nNewIndex;
+ }
+
+ // Ausketten
+ if( !pStt->pPrev )
+ {
+ pFirst = pEnd->pNext;
+ pEnd->pNext->pPrev = 0;
+ }
+ else
+ pStt->pPrev->pNext = pEnd->pNext;
+
+ if( !pEnd->pNext )
+ {
+ pLast = pStt->pPrev;
+ pStt->pPrev->pNext = 0;
+ }
+ else
+ pEnd->pNext->pPrev = pStt->pPrev;
+
+ // wieder einketten
+ pStt->pPrev = pInsPos->pPrev;
+ pEnd->pNext = pInsPos;
+
+ if( pInsPos->pPrev )
+ pInsPos->pPrev->pNext = pStt;
+ pInsPos->pPrev = pEnd;
+
+ if( pInsPos == pFirst )
+ pFirst = pStt;
+
+ if( nNewIndex < nOldIndex ) // es wurde nach vorne verschoben
+ {
+ while( pInsPos && pInsPos->nIndex <= nOldIndex )
+ {
+ ++pInsPos->nIndex;
+ pInsPos = pInsPos->pNext;
+ }
+ }
+ else // es wurde nach hinten verschoben
+ {
+ while( pStt->pPrev && pStt->pPrev->nIndex > nOldIndex )
+ {
+ pStt = pStt->pPrev;
+ --pStt->nIndex;
+ }
+ }
+}
+
+void SwIndexReg::MoveTo( SwIndexReg& rArr )
+{
+ if( this != &rArr && pFirst )
+ {
+ SwIndex* pIdx = (SwIndex*)pFirst, *pNext;
+ while( pIdx )
+ {
+ pNext = pIdx->pNext;
+ pIdx->Assign( &rArr, pIdx->GetIndex() );
+ pIdx = pNext;
+ }
+ pFirst = 0, pLast = 0, pMiddle = 0;
+ }
+}
+
+
+
+
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
new file mode 100644
index 000000000000..250a868d0e2a
--- /dev/null
+++ b/sw/source/core/bastyp/init.cxx
@@ -0,0 +1,951 @@
+/*************************************************************************
+ *
+ * $RCSfile: init.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+
+#ifndef _HINTIDS_HXX
+#include
+#endif
+
+#ifndef _GLOBNAME_HXX
+#include
+#endif
+#ifndef _SV_MAPMOD_HXX
+#include
+#endif
+#ifndef _SYSTEM_HXX //autogen
+#include
+#endif
+
+#ifndef _XMLOFF_XMLCNITM_HXX
+#include
+#endif
+
+#ifndef _SFXMACITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_PBINITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_KEEPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_NLBKITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_HYZNITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_PROTITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_ULSPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_PRSZITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_OPAQITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_SHADITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_PRNTITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_BRKITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_TSTPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_LANGITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_WRLMITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_KERNITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_ESCPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_CSCOITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_LRSPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_ORPHITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_WIDWITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_NHYPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_SPLTITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_LSPCITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_BLNKITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_AKRNITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_CMAPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_DIALOGS_HRC
+#include
+#endif
+#ifndef _SVXSWAFOPT_HXX
+#include
+#endif
+#ifndef _MySVXACORR_HXX //autogen
+#include
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include
+#endif
+#ifndef _UNO_LINGU_HXX
+#include
+#endif
+
+#ifndef _FMTHBSH_HXX //autogen
+#include
+#endif
+#ifndef _FMTANCHR_HXX //autogen
+#include
+#endif
+#ifndef _FMTORNT_HXX //autogen
+#include
+#endif
+#ifndef _FMTSRND_HXX //autogen
+#include
+#endif
+#ifndef _FMTFSIZE_HXX //autogen
+#include
+#endif
+#ifndef _FMTFLD_HXX //autogen
+#include
+#endif
+#ifndef _FMTRFMRK_HXX //autogen
+#include
+#endif
+#ifndef _FMTTSPLT_HXX //autogen
+#include
+#endif
+#ifndef _FMTEIRO_HXX //autogen
+#include
+#endif
+#ifndef _FMTCLDS_HXX //autogen
+#include
+#endif
+#ifndef _FMTURL_HXX //autogen
+#include
+#endif
+#ifndef _FMTCNTNT_HXX //autogen
+#include
+#endif
+#ifndef _FMTHDFT_HXX //autogen
+#include
+#endif
+#ifndef _FMTPDSC_HXX //autogen
+#include
+#endif
+#ifndef _FMTFTN_HXX //autogen
+#include
+#endif
+#ifndef _FMTFORDR_HXX //autogen
+#include
+#endif
+#ifndef _FMTFLCNT_HXX //autogen
+#include
+#endif
+#ifndef _FCHRFMT_HXX //autogen
+#include
+#endif
+#ifndef _FMTINFMT_HXX //autogen
+#include
+#endif
+#ifndef _FMTCNCT_HXX //autogen
+#include
+#endif
+#ifndef _FMTLINE_HXX
+#include
+#endif
+#ifndef _FMTFTNTX_HXX
+#include
+#endif
+#ifndef _EDITSH_HXX
+#include
+#endif
+#ifndef _PAM_HXX
+#include
+#endif
+#ifndef _INIT_HXX
+#include
+#endif
+#ifndef _PARATR_HXX
+#include
+#endif
+#ifndef _GRFATR_HXX
+#include
+#endif
+#ifndef _TOX_HXX
+#include
+#endif
+#ifndef _CELLATR_HXX
+#include
+#endif
+#ifndef _TBLAFMT_HXX
+#include
+#endif
+#ifndef _VISCRS_HXX
+#include
+#endif
+#ifndef _FNTCACHE_HXX
+#include
+#endif
+#ifndef _DOC_HXX
+#include
+#endif
+#ifndef _NUMRULE_HXX
+#include
+#endif
+#ifndef _ACMPLWRD_HXX
+#include
+#endif
+#ifndef _FMTCLBL_HXX
+#include
+#endif
+#ifndef _CMDID_H
+#include
+#endif
+#ifndef _BREAKIT_HXX
+#include
+#endif
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+
+#ifndef _GRFCACHE_HXX
+#include
+#endif
+
+#endif
+
+
+extern void _FrmFinit();
+extern void ClearFEShellTabCols();
+
+/*************************************************************************
+|* einige Bereiche fuer die Set in Collections / Nodes
+|*************************************************************************/
+ // AttrSet-Range fuer die 2 Break-Attribute
+USHORT __FAR_DATA aBreakSetRange[] = {
+ RES_PAGEDESC, RES_BREAK,
+ 0 };
+
+ // AttrSet-Range fuer die TxtFmtColl
+USHORT __FAR_DATA aTxtFmtCollSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+ // AttrSet-Range fuer die GrfFmtColl
+USHORT __FAR_DATA aGrfFmtCollSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+ // AttrSet-Range fuer die TextNode
+USHORT __FAR_DATA aTxtNodeSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+ // AttrSet-Range fuer die NoTxtNode
+USHORT __FAR_DATA aNoTxtNodeSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+USHORT __FAR_DATA aTableSetRange[] = {
+ RES_FILL_ORDER, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_BREAK,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_HORI_ORIENT, RES_HORI_ORIENT,
+ RES_KEEP, RES_KEEP,
+ RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+USHORT __FAR_DATA aTableLineSetRange[] = {
+ RES_FILL_ORDER, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+USHORT __FAR_DATA aTableBoxSetRange[] = {
+ RES_FILL_ORDER, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_BOXATR_BEGIN, RES_BOXATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// AttrSet-Range fuer die SwFrmFmt
+USHORT __FAR_DATA aFrmFmtSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// AttrSet-Range fuer die SwCharFmt
+USHORT __FAR_DATA aCharFmtSetRange[] = {
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+// AttrSet-Range fuer die SwPageDescFmt
+USHORT __FAR_DATA aPgFrmFmtSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+};
+
+/******************************************************************************
+ * lege eine Tabelle fuer einen Zugriff auf die
+ * Default-Format-Attribute an
+ ******************************************************************************/
+SwDfltAttrTab __FAR_DATA aAttrTab;
+
+SfxItemInfo __FAR_DATA aSlotTab[] =
+{
+ { SID_ATTR_CHAR_CASEMAP, SFX_ITEM_POOLABLE }, // RES_CHRATR_CASEMAP
+ { SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEM_POOLABLE }, // RES_CHRATR_CHARSETCOLOR
+ { SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE }, // RES_CHRATR_COLOR
+ { SID_ATTR_CHAR_CONTOUR, SFX_ITEM_POOLABLE }, // RES_CHRATR_CONTOUR
+ { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CROSSEDOUT
+ { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEM_POOLABLE }, // RES_CHRATR_ESCAPEMENT
+ { SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE }, // RES_CHRATR_FONT
+ { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_FONTSIZE
+ { SID_ATTR_CHAR_KERNING, SFX_ITEM_POOLABLE }, // RES_CHRATR_KERNING
+ { SID_ATTR_CHAR_LANGUAGE, SFX_ITEM_POOLABLE }, // RES_CHRATR_LANGUAGE
+ { SID_ATTR_CHAR_POSTURE, SFX_ITEM_POOLABLE }, // RES_CHRATR_POSTURE
+ { SID_ATTR_CHAR_PROPSIZE, SFX_ITEM_POOLABLE }, // RES_CHRATR_PROPORTIONALFONTSIZE
+ { SID_ATTR_CHAR_SHADOWED, SFX_ITEM_POOLABLE }, // RES_CHRATR_SHADOWED
+ { SID_ATTR_CHAR_UNDERLINE, SFX_ITEM_POOLABLE }, // RES_CHRATR_UNDERLINE
+ { SID_ATTR_CHAR_WEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_WEIGHT
+ { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEM_POOLABLE }, // RES_CHRATR_WORDLINEMODE
+ { SID_ATTR_CHAR_AUTOKERN, SFX_ITEM_POOLABLE }, // RES_CHRATR_AUTOKERN
+ { SID_ATTR_FLASH, SFX_ITEM_POOLABLE }, // RES_CHRATR_BLINK
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_NOLINEBREAK
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_NOHYPHEN
+ { SID_ATTR_BRUSH_CHAR, SFX_ITEM_POOLABLE }, // RES_CHRATR_BACKGROUND
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_FONT
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_FONTSIZE
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_LANGUAGE
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_POSTURE
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_WEIGHT
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_FONT
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_FONTSIZE
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_LANGUAGE
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_POSTURE
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_WEIGHT
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_WRITING_DIRECTION
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY2
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY3
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY4
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY5
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY1
+
+ { FN_TXTATR_INET, 0 }, // RES_TXTATR_INETFMT
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY4
+ { 0, 0 }, // RES_TXTATR_REFMARK
+ { 0, 0 }, // RES_TXTATR_TOXMARK
+ { 0, 0 }, // RES_TXTATR_CHARFMT
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_TWO_LINES,
+ { 0, 0 }, // RES_TXTATR_CJK_RUBY,
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_UNKNOWN_CONTAINER,
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY5,
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY6,
+
+ { 0, 0 }, // RES_TXTATR_FIELD
+ { 0, 0 }, // RES_TXTATR_FLYCNT
+ { 0, 0 }, // RES_TXTATR_FTN
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_SOFTHYPH
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_HARDBLANK
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY1
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY2
+
+ { SID_ATTR_PARA_LINESPACE, SFX_ITEM_POOLABLE }, // RES_PARATR_LINESPACING
+ { SID_ATTR_PARA_ADJUST, SFX_ITEM_POOLABLE }, // RES_PARATR_ADJUST
+ { SID_ATTR_PARA_SPLIT, SFX_ITEM_POOLABLE }, // RES_PARATR_SPLIT
+ { SID_ATTR_PARA_ORPHANS, SFX_ITEM_POOLABLE }, // RES_PARATR_ORPHANS
+ { SID_ATTR_PARA_WIDOWS, SFX_ITEM_POOLABLE }, // RES_PARATR_WIDOWS
+ { SID_ATTR_TABSTOP, SFX_ITEM_POOLABLE }, // RES_PARATR_TABSTOP
+ { SID_ATTR_PARA_HYPHENZONE, SFX_ITEM_POOLABLE }, // RES_PARATR_HYPHENZONE
+ { FN_FORMAT_DROPCAPS, 0 }, // RES_PARATR_DROP
+ { SID_ATTR_PARA_REGISTER, SFX_ITEM_POOLABLE }, // RES_PARATR_REGISTER
+ { SID_ATTR_PARA_NUMRULE, 0 }, // RES_PARATR_NUMRULE
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_DUMMY2
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_FILL_ORDER
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRM_SIZE
+ { SID_ATTR_PAGE_PAPERBIN, SFX_ITEM_POOLABLE }, // RES_PAPER_BIN
+ { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE }, // RES_LR_SPACE
+ { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE }, // RES_UL_SPACE
+ { 0, 0 }, // RES_PAGEDESC
+ { SID_ATTR_PARA_PAGEBREAK, SFX_ITEM_POOLABLE }, // RES_BREAK
+ { 0, 0 }, // RES_CNTNT
+ { 0, SFX_ITEM_POOLABLE }, // RES_HEADER
+ { 0, SFX_ITEM_POOLABLE }, // RES_FOOTER
+ { 0, SFX_ITEM_POOLABLE }, // RES_PRINT
+ { FN_OPAQUE, SFX_ITEM_POOLABLE }, // RES_OPAQUE
+ { FN_SET_PROTECT, SFX_ITEM_POOLABLE }, // RES_PROTECT
+ { FN_SURROUND, SFX_ITEM_POOLABLE }, // RES_SURROUND
+ { FN_VERT_ORIENT, SFX_ITEM_POOLABLE }, // RES_VERT_ORIENT
+ { FN_HORI_ORIENT, SFX_ITEM_POOLABLE }, // RES_HORI_ORIENT
+ { 0, 0 }, // RES_ANCHOR
+ { SID_ATTR_BRUSH, SFX_ITEM_POOLABLE }, // RES_BACKGROUND
+ { SID_ATTR_BORDER_OUTER, SFX_ITEM_POOLABLE }, // RES_BOX
+ { SID_ATTR_BORDER_SHADOW, SFX_ITEM_POOLABLE }, // RES_SHADOW
+ { SID_ATTR_MACROITEM, SFX_ITEM_POOLABLE }, // RES_FRMMACRO
+ { FN_ATTR_COLUMNS, SFX_ITEM_POOLABLE }, // RES_COL
+ { SID_ATTR_PARA_KEEP, SFX_ITEM_POOLABLE }, // RES_KEEP
+ { 0, SFX_ITEM_POOLABLE }, // RES_URL
+ { 0, SFX_ITEM_POOLABLE }, // RES_EDIT_IN_READONLY
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_LAYOUT_SPLIT
+ { 0, 0 }, // RES_CHAIN
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_DUMMY2
+ { 0, SFX_ITEM_POOLABLE }, // RES_LINENUMBER
+ { 0, SFX_ITEM_POOLABLE }, // RES_FTN_AT_TXTEND
+ { 0, SFX_ITEM_POOLABLE }, // RES_END_AT_TXTEND
+ { 0, SFX_ITEM_POOLABLE }, // RES_COLUMNBALANCE
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_DUMMY7
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_DUMMY8
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_DUMMY9
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_MIRRORGRF
+ { SID_ATTR_GRAF_CROP, SFX_ITEM_POOLABLE }, // RES_GRFATR_CROPGRF
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_ROTATION,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_LUMINANCE,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CONTRAST,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CHANNELR,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CHANNELG,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_CHANNELB,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_GAMMA,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_INVERT,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_TRANSPARENCY,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY1,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY2,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY3,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY4,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY5,
+ { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_DUMMY6,
+
+ { 0, SFX_ITEM_POOLABLE }, // RES_BOXATR_FORMAT
+ { 0, 0 }, // RES_BOXATR_FORMULA,
+ { 0, SFX_ITEM_POOLABLE }, // RES_BOXATR_VALUE
+
+ { 0, SFX_ITEM_POOLABLE } // RES_UNKNOWNATR_CONTAINER
+};
+
+
+USHORT* SwAttrPool::pVersionMap1 = 0;
+USHORT* SwAttrPool::pVersionMap2 = 0;
+USHORT* SwAttrPool::pVersionMap3 = 0;
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+
+SwGraphicCache* SwGraphicCacheObj::pGrfCache = 0;
+
+#endif
+
+SwIndexReg* SwIndexReg::pEmptyIndexArray = 0;
+
+const sal_Char* __FAR_DATA pMarkToTable = "table";
+const sal_Char* __FAR_DATA pMarkToFrame = "frame";
+const sal_Char* __FAR_DATA pMarkToRegion = "region";
+const sal_Char* __FAR_DATA pMarkToText = "text";
+const sal_Char* __FAR_DATA pMarkToOutline = "outline";
+const sal_Char* __FAR_DATA pMarkToGraphic = "graphic";
+const sal_Char* __FAR_DATA pMarkToOLE = "ole";
+
+SvPtrarr *pGlobalOLEExcludeList = 0;
+
+SwAutoCompleteWord* SwDoc::pACmpltWords = 0;
+
+SwBreakIt* pBreakIt = 0;
+CharClass* pAppCharClass = 0;
+
+/******************************************************************************
+ * void _InitCore()
+ ******************************************************************************/
+class SwDontWrite : public SfxBoolItem
+{
+public:
+ SwDontWrite( USHORT nId ) : SfxBoolItem( nId ) {}
+
+ virtual USHORT GetVersion( USHORT nFFVer ) const;
+};
+
+USHORT SwDontWrite::GetVersion( USHORT nFFVer ) const
+{ return USHRT_MAX; }
+
+
+
+
+void _InitCore()
+{
+ SfxPoolItem* pItem;
+
+ // erstmal alle Attribut-Pointer auf 0 setzen
+ memset( aAttrTab, 0, (POOLATTR_END - POOLATTR_BEGIN) *
+ sizeof( SfxPoolItem* ) );
+
+ aAttrTab[ RES_CHRATR_CASEMAP- POOLATTR_BEGIN ] = new SvxCaseMapItem;
+ aAttrTab[ RES_CHRATR_CHARSETCOLOR- POOLATTR_BEGIN ] = new SvxCharSetColorItem;
+ aAttrTab[ RES_CHRATR_COLOR- POOLATTR_BEGIN ] = new SvxColorItem;
+ aAttrTab[ RES_CHRATR_CONTOUR- POOLATTR_BEGIN ] = new SvxContourItem;
+ aAttrTab[ RES_CHRATR_CROSSEDOUT- POOLATTR_BEGIN ] = new SvxCrossedOutItem;
+ aAttrTab[ RES_CHRATR_ESCAPEMENT- POOLATTR_BEGIN ] = new SvxEscapementItem;
+ aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ] =
+ new SvxFontItem( FAMILY_ROMAN,
+ System::GetStandardFont( STDFONT_ROMAN ).GetName(),
+ aEmptyStr, PITCH_VARIABLE,
+/*?? GetSystemCharSet() ->*/ ::gsl_getSystemTextEncoding() );
+
+ aAttrTab[ RES_CHRATR_FONTSIZE- POOLATTR_BEGIN ] = new SvxFontHeightItem;
+ aAttrTab[ RES_CHRATR_KERNING- POOLATTR_BEGIN ] = new SvxKerningItem;
+ aAttrTab[ RES_CHRATR_LANGUAGE- POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW);
+ aAttrTab[ RES_CHRATR_POSTURE- POOLATTR_BEGIN ] = new SvxPostureItem;
+ aAttrTab[ RES_CHRATR_PROPORTIONALFONTSIZE- POOLATTR_BEGIN ] = new SvxPropSizeItem;
+ aAttrTab[ RES_CHRATR_SHADOWED- POOLATTR_BEGIN ] = new SvxShadowedItem;
+ aAttrTab[ RES_CHRATR_UNDERLINE- POOLATTR_BEGIN ] = new SvxUnderlineItem;
+ aAttrTab[ RES_CHRATR_WEIGHT- POOLATTR_BEGIN ] = new SvxWeightItem;
+ aAttrTab[ RES_CHRATR_WORDLINEMODE- POOLATTR_BEGIN ] = new SvxWordLineModeItem;
+ aAttrTab[ RES_CHRATR_AUTOKERN- POOLATTR_BEGIN ] = new SvxAutoKernItem;
+ aAttrTab[ RES_CHRATR_BLINK - POOLATTR_BEGIN ]
+ = new SvxBlinkItem( FALSE, RES_CHRATR_BLINK );
+ aAttrTab[ RES_CHRATR_NOHYPHEN - POOLATTR_BEGIN ]
+ = new SvxNoHyphenItem( TRUE, RES_CHRATR_NOHYPHEN );
+ aAttrTab[ RES_CHRATR_NOLINEBREAK- POOLATTR_BEGIN ]
+ = new SvxNoLinebreakItem( TRUE, RES_CHRATR_NOLINEBREAK );
+ aAttrTab[ RES_CHRATR_BACKGROUND - POOLATTR_BEGIN ]
+ = new SvxBrushItem( RES_CHRATR_BACKGROUND );
+
+ // CJK-Attributes
+ aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ] = new SvxFontItem(
+ FAMILY_ROMAN, System::GetStandardFont( STDFONT_ROMAN ).GetName(),
+ aEmptyStr, PITCH_VARIABLE, ::gsl_getSystemTextEncoding(),
+ RES_CHRATR_CJK_FONT );
+
+ pItem = new SvxFontHeightItem;
+ pItem->SetWhich( RES_CHRATR_CJK_FONTSIZE );
+ aAttrTab[ RES_CHRATR_CJK_FONTSIZE - POOLATTR_BEGIN ] = pItem;
+
+ pItem = new SvxLanguageItem(LANGUAGE_DONTKNOW);
+ pItem->SetWhich( RES_CHRATR_CJK_LANGUAGE );
+ aAttrTab[ RES_CHRATR_CJK_LANGUAGE - POOLATTR_BEGIN ] = pItem;
+
+ pItem = new SvxPostureItem;
+ pItem->SetWhich( RES_CHRATR_CJK_POSTURE );
+ aAttrTab[ RES_CHRATR_CJK_POSTURE - POOLATTR_BEGIN ] = pItem;
+
+ pItem = new SvxWeightItem;
+ pItem->SetWhich( RES_CHRATR_CJK_WEIGHT );
+ aAttrTab[ RES_CHRATR_CJK_WEIGHT - POOLATTR_BEGIN ] = pItem;
+
+ // CTL-Attributes
+ aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] = new SvxFontItem(
+ FAMILY_ROMAN, System::GetStandardFont( STDFONT_ROMAN ).GetName(),
+ aEmptyStr, PITCH_VARIABLE, ::gsl_getSystemTextEncoding(),
+ RES_CHRATR_CTL_FONT );
+
+ pItem = new SvxFontHeightItem;
+ pItem->SetWhich( RES_CHRATR_CTL_FONTSIZE );
+ aAttrTab[ RES_CHRATR_CTL_FONTSIZE - POOLATTR_BEGIN ] = pItem;
+
+ pItem = new SvxLanguageItem(LANGUAGE_DONTKNOW);
+ pItem->SetWhich( RES_CHRATR_CTL_LANGUAGE );
+ aAttrTab[ RES_CHRATR_CTL_LANGUAGE - POOLATTR_BEGIN ] = pItem;
+
+ pItem = new SvxPostureItem;
+ pItem->SetWhich( RES_CHRATR_CTL_POSTURE );
+ aAttrTab[ RES_CHRATR_CTL_POSTURE - POOLATTR_BEGIN ] = pItem;
+
+ pItem = new SvxWeightItem;
+ pItem->SetWhich( RES_CHRATR_CTL_WEIGHT );
+ aAttrTab[ RES_CHRATR_CTL_WEIGHT - POOLATTR_BEGIN ] = pItem;
+
+ aAttrTab[ RES_CHRATR_CTL_WEIGHT - POOLATTR_BEGIN ] = pItem;
+
+ aAttrTab[ RES_CHRATR_WRITING_DIRECTION - POOLATTR_BEGIN ] =
+ new SfxBoolItem( RES_CHRATR_WRITING_DIRECTION );
+
+// CharakterAttr - Dummies
+ aAttrTab[ RES_CHRATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY1 );
+ aAttrTab[ RES_CHRATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY2 );
+ aAttrTab[ RES_CHRATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY3 );
+ aAttrTab[ RES_CHRATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY4 );
+ aAttrTab[ RES_CHRATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY5 );
+// CharakterAttr - Dummies
+
+// TextAttr Ende - Dummies
+ aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ]
+ = new SfxBoolItem( RES_TXTATR_DUMMY4 );
+// TextAttr Ende - Dummies
+
+ aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ]
+ = new SwFmtINetFmt( aEmptyStr, aEmptyStr );
+ aAttrTab[ RES_TXTATR_REFMARK - POOLATTR_BEGIN ] = new SwFmtRefMark( aEmptyStr );
+ aAttrTab[ RES_TXTATR_TOXMARK - POOLATTR_BEGIN ] = new SwTOXMark;
+ aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 );
+
+ aAttrTab[ RES_TXTATR_TWO_LINES - POOLATTR_BEGIN ] =
+//JP 28.07.00: must be changed to the correct attributes!!
+ new SfxBoolItem( RES_TXTATR_TWO_LINES);
+ aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] =
+//JP 28.07.00: must be changed to the correct attributes!!
+ new SfxBoolItem( RES_TXTATR_CJK_RUBY );
+ aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] =
+ new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER );
+
+ aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld;
+ aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
+ aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
+ aAttrTab[ RES_TXTATR_SOFTHYPH- POOLATTR_BEGIN ] = new SwFmtSoftHyph;
+ aAttrTab[ RES_TXTATR_HARDBLANK- POOLATTR_BEGIN ] = new SwFmtHardBlank( ' ', FALSE );
+
+// TextAttr ohne Ende - Dummies
+ aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 );
+ aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
+ aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
+ aAttrTab[ RES_TXTATR_DUMMY6 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY6 );
+// TextAttr ohne Ende - Dummies
+
+ aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem;
+ aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem;
+ aAttrTab[ RES_PARATR_SPLIT- POOLATTR_BEGIN ] = new SvxFmtSplitItem;
+ aAttrTab[ RES_PARATR_WIDOWS- POOLATTR_BEGIN ] = new SvxWidowsItem;
+ aAttrTab[ RES_PARATR_ORPHANS- POOLATTR_BEGIN ] = new SvxOrphansItem;
+ aAttrTab[ RES_PARATR_TABSTOP- POOLATTR_BEGIN ] = new
+ SvxTabStopItem( 1, SVX_TAB_DEFDIST );
+
+ pItem = new SvxHyphenZoneItem;
+ ((SvxHyphenZoneItem*)pItem)->GetMaxHyphens() = 0; // Default z.Z. auf 0
+ aAttrTab[ RES_PARATR_HYPHENZONE- POOLATTR_BEGIN ] = pItem;
+
+ aAttrTab[ RES_PARATR_DROP- POOLATTR_BEGIN ] = new SwFmtDrop;
+ aAttrTab[ RES_PARATR_REGISTER - POOLATTR_BEGIN ] = new SwRegisterItem( FALSE );
+ aAttrTab[ RES_PARATR_NUMRULE - POOLATTR_BEGIN ] = new SwNumRuleItem( aEmptyStr );
+
+// ParaAttr - Dummies
+ aAttrTab[ RES_PARATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_DUMMY2 );
+// ParatAttr - Dummies
+
+ aAttrTab[ RES_FILL_ORDER- POOLATTR_BEGIN ] = new SwFmtFillOrder;
+ aAttrTab[ RES_FRM_SIZE- POOLATTR_BEGIN ] = new SwFmtFrmSize;
+ aAttrTab[ RES_PAPER_BIN- POOLATTR_BEGIN ] = new SvxPaperBinItem;
+ aAttrTab[ RES_LR_SPACE- POOLATTR_BEGIN ] = new SvxLRSpaceItem;
+ aAttrTab[ RES_UL_SPACE- POOLATTR_BEGIN ] = new SvxULSpaceItem;
+ aAttrTab[ RES_PAGEDESC- POOLATTR_BEGIN ] = new SwFmtPageDesc;
+ aAttrTab[ RES_BREAK- POOLATTR_BEGIN ] = new SvxFmtBreakItem;
+ aAttrTab[ RES_CNTNT- POOLATTR_BEGIN ] = new SwFmtCntnt;
+ aAttrTab[ RES_HEADER- POOLATTR_BEGIN ] = new SwFmtHeader;
+ aAttrTab[ RES_FOOTER- POOLATTR_BEGIN ] = new SwFmtFooter;
+ aAttrTab[ RES_PRINT- POOLATTR_BEGIN ] = new SvxPrintItem;
+ aAttrTab[ RES_OPAQUE- POOLATTR_BEGIN ] = new SvxOpaqueItem;
+ aAttrTab[ RES_PROTECT- POOLATTR_BEGIN ] = new SvxProtectItem;
+ aAttrTab[ RES_SURROUND- POOLATTR_BEGIN ] = new SwFmtSurround;
+ aAttrTab[ RES_VERT_ORIENT- POOLATTR_BEGIN ] = new SwFmtVertOrient;
+ aAttrTab[ RES_HORI_ORIENT- POOLATTR_BEGIN ] = new SwFmtHoriOrient;
+ aAttrTab[ RES_ANCHOR- POOLATTR_BEGIN ] = new SwFmtAnchor;
+ aAttrTab[ RES_BACKGROUND- POOLATTR_BEGIN ] = new SvxBrushItem;
+ aAttrTab[ RES_BOX- POOLATTR_BEGIN ] = new SvxBoxItem;
+ aAttrTab[ RES_SHADOW- POOLATTR_BEGIN ] = new SvxShadowItem;
+ aAttrTab[ RES_FRMMACRO- POOLATTR_BEGIN ] = new SvxMacroItem;
+ aAttrTab[ RES_COL- POOLATTR_BEGIN ] = new SwFmtCol;
+ aAttrTab[ RES_KEEP - POOLATTR_BEGIN ] = new SvxFmtKeepItem( FALSE );
+ aAttrTab[ RES_URL - POOLATTR_BEGIN ] = new SwFmtURL();
+ aAttrTab[ RES_EDIT_IN_READONLY - POOLATTR_BEGIN ] = new SwFmtEditInReadonly;
+ aAttrTab[ RES_LAYOUT_SPLIT - POOLATTR_BEGIN ] = new SwFmtLayoutSplit;
+ aAttrTab[ RES_CHAIN - POOLATTR_BEGIN ] = new SwFmtChain;
+ aAttrTab[ RES_FRMATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_FRMATR_DUMMY2 );
+ aAttrTab[ RES_LINENUMBER - POOLATTR_BEGIN ] = new SwFmtLineNumber;
+ aAttrTab[ RES_FTN_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtFtnAtTxtEnd;
+ aAttrTab[ RES_END_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtEndAtTxtEnd;
+ aAttrTab[ RES_COLUMNBALANCE - POOLATTR_BEGIN ] = new SwFmtNoBalancedColumns;
+
+// FrameAttr - Dummies
+ aAttrTab[ RES_FRMATR_DUMMY7 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_FRMATR_DUMMY7 );
+ aAttrTab[ RES_FRMATR_DUMMY8 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_FRMATR_DUMMY8 );
+ aAttrTab[ RES_FRMATR_DUMMY9 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_FRMATR_DUMMY9 );
+// FrameAttr - Dummies
+
+ aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf;
+ aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf;
+
+ aAttrTab[ RES_GRFATR_ROTATION - POOLATTR_BEGIN ] = new SwRotationGrf;
+ aAttrTab[ RES_GRFATR_LUMINANCE - POOLATTR_BEGIN ] = new SwLuminanceGrf;
+ aAttrTab[ RES_GRFATR_CONTRAST - POOLATTR_BEGIN ] = new SwContrastGrf;
+ aAttrTab[ RES_GRFATR_CHANNELR - POOLATTR_BEGIN ] = new SwChannelRGrf;
+ aAttrTab[ RES_GRFATR_CHANNELG - POOLATTR_BEGIN ] = new SwChannelGGrf;
+ aAttrTab[ RES_GRFATR_CHANNELB - POOLATTR_BEGIN ] = new SwChannelBGrf;
+ aAttrTab[ RES_GRFATR_GAMMA - POOLATTR_BEGIN ] = new SwGammaGrf;
+ aAttrTab[ RES_GRFATR_INVERT - POOLATTR_BEGIN ] = new SwInvertGrf;
+ aAttrTab[ RES_GRFATR_TRANSPARENCY - POOLATTR_BEGIN ] = new SwTransparencyGrf;
+ aAttrTab[ RES_GRFATR_DRAWMODE - POOLATTR_BEGIN ] = new SwDrawModeGrf;
+
+// GraphicAttr - Dummies
+ aAttrTab[ RES_GRFATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY1 );
+ aAttrTab[ RES_GRFATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY2 );
+ aAttrTab[ RES_GRFATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY3 );
+ aAttrTab[ RES_GRFATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY4 );
+ aAttrTab[ RES_GRFATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY5 );
+// GraphicAttr - Dummies
+
+ aAttrTab[ RES_BOXATR_FORMAT- POOLATTR_BEGIN ] = new SwTblBoxNumFormat;
+ aAttrTab[ RES_BOXATR_FORMULA- POOLATTR_BEGIN ] = new SwTblBoxFormula( aEmptyStr );
+ aAttrTab[ RES_BOXATR_VALUE- POOLATTR_BEGIN ] = new SwTblBoxValue;
+
+ aAttrTab[ RES_UNKNOWNATR_CONTAINER- POOLATTR_BEGIN ] =
+ new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER );
+
+ // 1. Version - neue Attribute:
+ // - RES_CHRATR_BLINK
+ // - RES_CHRATR_NOHYPHEN
+ // - RES_CHRATR_NOLINEBREAK
+ // - RES_PARATR_REGISTER
+ // + 2 Dummies fuer die einzelnen "Bereiche"
+ SwAttrPool::pVersionMap1 = new USHORT[ 60 ];
+ for( USHORT i = 1; i <= 17; i++ )
+ SwAttrPool::pVersionMap1[ i-1 ] = i;
+ for ( i = 18; i <= 27; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 5;
+ for ( i = 28; i <= 35; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 7;
+ for ( i = 36; i <= 58; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 10;
+ for ( i = 59; i <= 60; ++i )
+ SwAttrPool::pVersionMap1[ i-1 ] = i + 12;
+
+ // 2. Version - neue Attribute:
+ // 10 Dummies fuer den Frame "Bereich"
+ SwAttrPool::pVersionMap2 = new USHORT[ 75 ];
+ for( i = 1; i <= 70; i++ )
+ SwAttrPool::pVersionMap2[ i-1 ] = i;
+ for ( i = 71; i <= 75; ++i )
+ SwAttrPool::pVersionMap2[ i-1 ] = i + 10;
+
+ // 3. Version - neue Attribute:
+ // neue Attribute und Dummies fuer die CJK-Version
+ // und neue Grafik-Attribute
+ SwAttrPool::pVersionMap3 = new USHORT[ 86 ];
+ for( i = 1; i <= 21; i++ )
+ SwAttrPool::pVersionMap3[ i-1 ] = i;
+ for ( i = 22; i <= 27; ++i )
+ SwAttrPool::pVersionMap3[ i-1 ] = i + 15;
+ for ( i = 28; i <= 82; ++i )
+ SwAttrPool::pVersionMap3[ i-1 ] = i + 20;
+ for ( i = 83; i <= 86; ++i )
+ SwAttrPool::pVersionMap3[ i-1 ] = i + 35;
+
+ pBreakIt = new SwBreakIt();
+ pAppCharClass = new CharClass( SvxCreateLocale( LANGUAGE_SYSTEM ));
+
+ _FrmInit();
+ _TextInit();
+
+ SwSelPaintRects::pMapMode = new MapMode;
+ SwFntObj::pPixMap = new MapMode;
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+ // Grafik-Cache Klasse anlegen
+ SwGraphicCacheObj::pGrfCache = new SwGraphicCache;
+
+#endif
+
+ SwIndexReg::pEmptyIndexArray = new SwIndexReg;
+
+ pGlobalOLEExcludeList = new SvPtrarr;
+
+ const SvxSwAutoFmtFlags& rAFlags = OFF_APP()->GetAutoCorrect()->GetSwFlags();
+ SwDoc::pACmpltWords = new SwAutoCompleteWord( rAFlags.nAutoCmpltListLen,
+ rAFlags.nAutoCmpltWordLen );
+}
+
+/******************************************************************************
+ * void _FinitCore()
+ ******************************************************************************/
+
+
+
+void _FinitCore()
+{
+ _FrmFinit();
+ _TextFinit();
+
+ delete pBreakIt;
+ delete pAppCharClass;
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+
+ // Grafik-Cache Klasse zerstoeren
+ delete SwGraphicCacheObj::pGrfCache;
+
+#endif
+
+ // das default TableAutoFormat zerstoeren
+ delete SwTableAutoFmt::pDfltBoxAutoFmt;
+
+ delete SwSelPaintRects::pMapMode;
+ delete SwFntObj::pPixMap;
+
+ delete SwEditShell::pAutoFmtFlags;
+ delete SwNumRule::pDefBulletFont;
+
+#ifndef PRODUCT
+ //Defaultattribut freigeben lassen um asserts zu vermeiden.
+ if ( aAttrTab[0]->GetRef() )
+ SfxItemPool::ReleaseDefaults( aAttrTab, POOLATTR_END-POOLATTR_BEGIN, FALSE);
+#endif
+
+ delete SwDoc::pTextNmArray;
+ delete SwDoc::pListsNmArray;
+ delete SwDoc::pExtraNmArray;
+ delete SwDoc::pRegisterNmArray;
+ delete SwDoc::pDocNmArray;
+ delete SwDoc::pHTMLNmArray;
+ delete SwDoc::pFrmFmtNmArray;
+ delete SwDoc::pChrFmtNmArray;
+ delete SwDoc::pHTMLChrFmtNmArray;
+ delete SwDoc::pPageDescNmArray;
+ delete SwDoc::pNumRuleNmArray;
+ delete SwDoc::pACmpltWords;
+
+ // loesche alle default-Attribute
+ SfxPoolItem* pHt;
+ for( USHORT n = 0; n < POOLATTR_END - POOLATTR_BEGIN; n++ )
+ if( 0 != ( pHt = aAttrTab[n] ))
+ delete pHt;
+
+ ::ClearFEShellTabCols();
+
+ delete SwIndexReg::pEmptyIndexArray;
+ delete SwAttrPool::pVersionMap1;
+ delete SwAttrPool::pVersionMap2;
+
+ for ( USHORT i = 0; i < pGlobalOLEExcludeList->Count(); ++i )
+ delete (SvGlobalName*)(*pGlobalOLEExcludeList)[i];
+ delete pGlobalOLEExcludeList;
+}
+
+// returns the APP - CharClass instance - used for all ToUpper/ToLower/...
+CharClass& GetAppCharClass()
+{
+ return *pAppCharClass;
+}
+
+
+
diff --git a/sw/source/core/bastyp/makefile.mk b/sw/source/core/bastyp/makefile.mk
new file mode 100644
index 000000000000..29f9edbf1231
--- /dev/null
+++ b/sw/source/core/bastyp/makefile.mk
@@ -0,0 +1,111 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning 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=sw
+TARGET=bastyp
+
+PROJECTPCH=core_pch
+PDBTARGET=core_pch
+PROJECTPCHSOURCE=..\core_1st\core_pch
+
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/sw.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ bparr.cxx \
+ breakit.cxx \
+ calc.cxx \
+ index.cxx \
+ init.cxx \
+ ring.cxx \
+ swcache.cxx \
+ swrect.cxx \
+ swregion.cxx \
+ swtypes.cxx \
+ tabcol.cxx
+
+SLOFILES = \
+ $(SLO)$/bparr.obj \
+ $(SLO)$/breakit.obj \
+ $(SLO)$/calc.obj \
+ $(SLO)$/index.obj \
+ $(SLO)$/init.obj \
+ $(SLO)$/ring.obj \
+ $(SLO)$/swcache.obj \
+ $(SLO)$/swrect.obj \
+ $(SLO)$/swregion.obj \
+ $(SLO)$/swtypes.obj \
+ $(SLO)$/tabcol.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sw/source/core/bastyp/ring.cxx b/sw/source/core/bastyp/ring.cxx
new file mode 100644
index 000000000000..4e826ae23ee9
--- /dev/null
+++ b/sw/source/core/bastyp/ring.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: ring.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include "ring.hxx"
+
+
+/*************************************************************************
+|*
+|* Ring::Ring()
+|*
+|* Ersterstellung VB 02.07.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+Ring::Ring( Ring *pObj )
+{
+ if( !pObj )
+ pNext = this, pPrev = this;
+ else
+ {
+ pNext = pObj;
+ pPrev = pObj->pPrev;
+ pObj->pPrev = this;
+ pPrev->pNext = this;
+ }
+}
+
+/*************************************************************************
+|*
+|* Ring::~Ring()
+|*
+|* Ersterstellung VB 02.07.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+Ring::~Ring()
+{
+ pNext->pPrev = pPrev;
+ pPrev->pNext = pNext;
+}
+
+/*************************************************************************
+|*
+|* Ring::MoveTo
+|*
+|* Ersterstellung VB 4.3.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+void Ring::MoveTo(Ring *pDestRing)
+{
+ // loeschen aus dem alten
+ pNext->pPrev = pPrev;
+ pPrev->pNext = pNext;
+
+ // im neuen einfuegen
+ if( pDestRing )
+ {
+ pNext = pDestRing;
+ pPrev = pDestRing->pPrev;
+ pDestRing->pPrev = this;
+ pPrev->pNext = this;
+ }
+ else
+ pNext = pPrev = this;
+
+}
+
+void Ring::MoveRingTo(Ring *pDestRing)
+{
+ // den gesamten Ring in den DestRing einfuegen
+ Ring* pMyPrev = pPrev;
+ Ring* pDestPrev = pDestRing->pPrev;
+
+ pMyPrev->pNext = pDestRing;
+ pDestPrev->pNext = this;
+ pDestRing->pPrev = pMyPrev;
+ pPrev = pDestPrev;
+}
+
+
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
new file mode 100644
index 000000000000..54cc0fea4bae
--- /dev/null
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -0,0 +1,699 @@
+/*************************************************************************
+ *
+ * $RCSfile: swcache.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include
+#endif
+#ifndef _STREAM_HXX //autogen
+#include
+#endif
+#ifndef _TOOLS_TEMPFILE_HXX
+#include
+#endif
+#include "errhdl.hxx"
+#include "swcache.hxx"
+
+#ifndef PRODUCT
+ #include // getenv()
+ #include // sprintf()
+#endif
+
+
+SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*);
+
+#ifdef PRODUCT
+#define INCREMENT( nVar )
+#else
+#define INCREMENT( nVar ) ++nVar
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::Check()
+|*
+|* Ersterstellung MA 23. Mar. 94
+|* Letzte Aenderung MA 23. Mar. 94
+|*
+|*************************************************************************/
+
+#ifndef PRODUCT
+
+void SwCache::Check()
+{
+ if ( !pRealFirst )
+ return;
+
+ //Konsistenspruefung.
+ ASSERT( !pLast->GetNext(), "Last but not last." );
+ ASSERT( !pRealFirst->GetPrev(), "First but not first." );
+ USHORT nCnt = 0;
+ BOOL bFirstFound = FALSE;
+ SwCacheObj *pObj = pRealFirst;
+ SwCacheObj *pRekursive = pObj;
+ while ( pObj )
+ {
+ //Das Objekt muss auch auf dem Rueckwaertsweg gefunden werden.
+ SwCacheObj *pTmp = pLast;
+ while ( pTmp && pTmp != pObj )
+ pTmp = pTmp->GetPrev();
+ ASSERT( pTmp, "Objekt not found." );
+
+ ++nCnt;
+ if ( pObj == pFirst )
+ bFirstFound = TRUE;
+ if ( !pObj->GetNext() )
+ ASSERT( pObj == pLast, "Last not Found." );
+ pObj = pObj->GetNext();
+ ASSERT( pObj != pRekursive, "Recursion in SwCache." );
+ }
+ ASSERT( bFirstFound, "First not Found." );
+ ASSERT( (nCnt + aFreePositions.Count()) == Count(), "Lost Chain." );
+ if ( Count() == nCurMax )
+ ASSERT( (nCurMax - nCnt) == aFreePositions.Count(), "Lost FreePositions." );
+}
+#endif
+
+#if !defined(PRODUCT) && defined(MADEBUG)
+#define CHECK Check();
+#else
+#define CHECK
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::SwCache(), ~SwCache()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize
+#ifndef PRODUCT
+ , const ByteString &rNm
+#endif
+ ) :
+ SwCacheObjArr( (BYTE)nInitSize, (BYTE)nGrowSize ),
+ aFreePositions( 5, 5 ),
+ nMax( nInitSize ),
+ nCurMax( nInitSize ),
+ pRealFirst( 0 ),
+ pFirst( 0 ),
+ pLast( 0 )
+#ifndef PRODUCT
+ , aName( rNm ),
+ nAppend( 0 ),
+ nInsertFree( 0 ),
+ nReplace( 0 ),
+ nGetSuccess( 0 ),
+ nGetFail( 0 ),
+ nToTop( 0 ),
+ nDelete( 0 ),
+ nGetSeek( 0 ),
+ nAverageSeekCnt( 0 ),
+ nFlushCnt( 0 ),
+ nFlushedObjects( 0 ),
+ nIncreaseMax( 0 ),
+ nDecreaseMax( 0 )
+#endif
+{
+}
+
+#ifndef PRODUCT
+
+
+
+SwCache::~SwCache()
+{
+#ifndef MAC
+ static USHORT nOpenMode = STREAM_WRITE | STREAM_TRUNC;
+ String sExt(String::CreateFromAscii("log"));
+ TempFile aTempFile(String::CreateFromAscii("swcache"), &sExt);
+ SvFileStream aStream( aTempFile.GetName(), nOpenMode );
+ nOpenMode = STREAM_WRITE;
+
+ if( !aStream.GetError() )
+ {
+ aStream.Seek( STREAM_SEEK_TO_END );
+ ByteString sOut( aName ); sOut += '\n';
+ (( sOut += "Anzahl neuer Eintraege: " ) += nAppend )+= '\n';
+ (( sOut += "Anzahl Insert auf freie Plaetze: " ) += nInsertFree )+= '\n';
+ (( sOut += "Anzahl Ersetzungen: " ) += nReplace )+= '\n';
+ (( sOut += "Anzahl Erfolgreicher Get's: " ) += nGetSuccess )+= '\n';
+ (( sOut += "Anzahl Fehlgeschlagener Get's: " ) += nGetFail )+= '\n';
+ (( sOut += "Anzahl Umsortierungen (LRU): " ) += nToTop )+= '\n';
+ (( sOut += "Anzahl Loeschungen: " ) += nDelete )+= '\n';
+ (( sOut += "Anzahl Get's ohne Index: " ) += nGetSeek )+= '\n';
+ (( sOut += "Anzahl Seek fuer Get ohne Index: " ) += nAverageSeekCnt )+= '\n';
+ (( sOut += "Anzahl Flush-Aufrufe: " ) += nFlushCnt )+= '\n';
+ (( sOut += "Anzahl geflush'ter Objekte: " ) += nFlushedObjects )+= '\n';
+ (( sOut += "Anzahl Cache-Erweiterungen: " ) += nIncreaseMax )+= '\n';
+ (( sOut += "Anzahl Cache-Verkleinerungen: " ) += nDecreaseMax )+= '\n';
+
+ aStream << sOut.GetBuffer()
+ << "-------------------------------------------------------"
+ << endl;
+ }
+ Check();
+#endif
+}
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::Flush()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+void SwCache::Flush( const BYTE nPercent )
+{
+ ASSERT( nPercent == 100, "SwCache::Flush() arbeitet nur 100%'ig" );
+
+ INCREMENT( nFlushCnt );
+ SwCacheObj *pObj = pRealFirst;
+ pRealFirst = pFirst = pLast = 0;
+ SwCacheObj *pTmp;
+ while ( pObj )
+ {
+#ifndef PRODUCT
+ if ( pObj->IsLocked() )
+ {
+ ASSERT( TRUE, "Flushing locked objects." );
+ if ( !pRealFirst )
+ {
+ pRealFirst = pFirst = pLast = pObj;
+ pTmp = pObj->GetNext();
+ pObj->SetNext( 0 ); pObj->SetPrev( 0 );
+ pObj = pTmp;
+ }
+ else
+ { pLast->SetNext( pObj );
+ pObj->SetPrev( pLast );
+ pLast = pObj;
+ pTmp = pObj->GetNext();
+ pObj->SetNext( 0 );
+ pObj = pTmp;
+ }
+ }
+ else
+#endif
+ {
+ pTmp = (SwCacheObj*)pObj;
+ pObj = pTmp->GetNext();
+ aFreePositions.Insert( pTmp->GetCachePos(), aFreePositions.Count() );
+ *(pData + pTmp->GetCachePos()) = (void*)0;
+ delete pTmp;
+ INCREMENT( nFlushedObjects );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwCache::ToTop()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 24. Apr. 95
+|*
+|*************************************************************************/
+
+
+void SwCache::ToTop( SwCacheObj *pObj )
+{
+ INCREMENT( nToTop );
+
+ //Objekt aus der LRU-Kette ausschneiden und am Anfang einfuegen.
+ if ( pRealFirst == pObj ) //pFirst wurde vom Aufrufer geprueft!
+ { CHECK;
+ return;
+ }
+
+ if ( !pRealFirst )
+ { //Der erste wird eingetragen.
+ ASSERT( !pFirst && !pLast, "First not first." );
+ pRealFirst = pFirst = pLast = pObj;
+ CHECK;
+ return;
+ }
+
+ //Ausschneiden.
+ if ( pObj == pLast )
+ {
+ ASSERT( pObj->GetPrev(), "Last but no Prev." );
+ pLast = pObj->GetPrev();
+ pLast->SetNext( 0 );
+ }
+ else
+ {
+ if ( pObj->GetNext() )
+ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+ if ( pObj->GetPrev() )
+ pObj->GetPrev()->SetNext( pObj->GetNext() );
+ }
+
+ //Am (virtuellen) Anfang einfuegen.
+ if ( pRealFirst == pFirst )
+ {
+ pRealFirst->SetPrev( pObj );
+ pObj->SetNext( pRealFirst );
+ pObj->SetPrev( 0 );
+ pRealFirst = pFirst = pObj;
+ CHECK;
+ }
+ else
+ {
+ ASSERT( pFirst, "ToTop, First ist not RealFirst an Empty." );
+
+ if ( pFirst->GetPrev() )
+ {
+ pFirst->GetPrev()->SetNext( pObj );
+ pObj->SetPrev( pFirst->GetPrev() );
+ }
+ else
+ pObj->SetPrev( 0 );
+ pFirst->SetPrev( pObj );
+ pObj->SetNext( pFirst );
+ pFirst = pObj;
+ CHECK;
+ }
+}
+
+/*************************************************************************
+|*
+|* SwCache::Get()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 22. Aug. 94
+|*
+|*************************************************************************/
+
+
+SwCacheObj *SwCache::Get( const void *pOwner, const USHORT nIndex,
+ const BOOL bToTop )
+{
+ SwCacheObj *pRet;
+ if ( 0 != (pRet = nIndex < Count() ? operator[]( nIndex ) : 0) )
+ {
+ if ( !pRet->IsOwner( pOwner ) )
+ pRet = 0;
+ else if ( bToTop && pRet != pFirst )
+ ToTop( pRet );
+ }
+
+#ifndef PRODUCT
+ if ( pRet )
+ ++nGetSuccess;
+ else
+ ++nGetFail;
+#endif
+
+ return pRet;
+}
+
+
+
+SwCacheObj *SwCache::Get( const void *pOwner, const BOOL bToTop )
+{
+ SwCacheObj *pRet = pRealFirst;
+ while ( pRet && !pRet->IsOwner( pOwner ) )
+ {
+ INCREMENT( nAverageSeekCnt );
+ pRet = pRet->GetNext();
+ }
+
+ if ( bToTop && pRet && pRet != pFirst )
+ ToTop( pRet );
+
+#ifndef PRODUCT
+ if ( pRet )
+ ++nGetSuccess;
+ else
+ ++nGetFail;
+ ++nGetSeek;
+#endif
+ return pRet;
+}
+
+/*************************************************************************
+|*
+|* SwCache::Delete()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+void SwCache::DeleteObj( SwCacheObj *pObj )
+{
+ CHECK;
+ ASSERT( !pObj->IsLocked(), "SwCache::Delete: Object ist Locked." );
+ if ( pObj->IsLocked() )
+ return;
+
+ if ( pFirst == pObj )
+ {
+ if ( pFirst->GetNext() )
+ pFirst = pFirst->GetNext();
+ else
+ pFirst = pFirst->GetPrev();
+ }
+ if ( pRealFirst == pObj )
+ pRealFirst = pRealFirst->GetNext();
+ if ( pLast == pObj )
+ pLast = pLast->GetPrev();
+ if ( pObj->GetPrev() )
+ pObj->GetPrev()->SetNext( pObj->GetNext() );
+ if ( pObj->GetNext() )
+ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+
+ aFreePositions.Insert( pObj->GetCachePos(), aFreePositions.Count() );
+ *(pData + pObj->GetCachePos()) = (void*)0;
+ delete pObj;
+
+ CHECK;
+ if ( Count() > nCurMax &&
+ (nCurMax <= (Count() - aFreePositions.Count())) )
+ {
+ //Falls moeglich wieder verkleinern, dazu muessen allerdings ausreichend
+ //Freie Positionen bereitstehen.
+ //Unangenehmer Nebeneffekt ist, das die Positionen verschoben werden
+ //muessen, und die Eigentuemer der Objekte diese wahrscheinlich nicht
+ //wiederfinden werden.
+ for ( USHORT i = 0; i < Count(); ++i )
+ {
+ SwCacheObj *pObj = operator[](i);
+ if ( !pObj )
+ { SwCacheObjArr::Remove( i, 1 );
+ --i;
+ }
+ else
+ pObj->SetCachePos( i );
+ }
+ aFreePositions.Remove( 0, aFreePositions.Count() );
+ }
+ CHECK;
+}
+
+/*
+
+
+void SwCache::Delete( const void *pOwner, const USHORT nIndex )
+{
+ INCREMENT( nDelete );
+ SwCacheObj *pObj;
+ if ( 0 != (pObj = Get( pOwner, nIndex, FALSE )) )
+ DeleteObj( pObj );
+}
+*/
+
+
+
+void SwCache::Delete( const void *pOwner )
+{
+ INCREMENT( nDelete );
+ SwCacheObj *pObj;
+ if ( 0 != (pObj = Get( pOwner, BOOL(FALSE) )) )
+ DeleteObj( pObj );
+}
+
+
+/*************************************************************************
+|*
+|* SwCache::Insert()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 20. Sep. 94
+|*
+|*************************************************************************/
+
+
+BOOL SwCache::Insert( SwCacheObj *pNew )
+{
+ CHECK;
+ ASSERT( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." );
+
+ USHORT nPos;//Wird hinter den if's zum setzen am Obj benutzt.
+ if ( Count() < nCurMax )
+ {
+ //Es ist noch Platz frei, also einfach einfuegen.
+ INCREMENT( nAppend );
+ nPos = Count();
+ SwCacheObjArr::C40_INSERT( SwCacheObj, pNew, nPos );
+ }
+ else if ( aFreePositions.Count() )
+ {
+ //Es exitieren Platzhalter, also den letzten benutzen.
+ INCREMENT( nInsertFree );
+ const USHORT nFreePos = aFreePositions.Count() - 1;
+ nPos = aFreePositions[ nFreePos ];
+ *(pData + nPos) = pNew;
+ aFreePositions.Remove( nFreePos );
+ }
+ else
+ {
+ INCREMENT( nReplace );
+ //Der letzte des LRU fliegt raus.
+ SwCacheObj *pObj = pLast;
+
+ while ( pObj && pObj->IsLocked() )
+ pObj = pObj->GetPrev();
+ if ( !pObj )
+ {
+ ASSERT( FALSE, "Cache overflow." );
+ return FALSE;
+ }
+
+ nPos = pObj->GetCachePos();
+ if ( pObj == pLast )
+ { ASSERT( pObj->GetPrev(), "Last but no Prev" );
+ pLast = pObj->GetPrev();
+ pLast->SetNext( 0 );
+ }
+ else
+ {
+ if ( pObj->GetPrev() )
+ pObj->GetPrev()->SetNext( pObj->GetNext() );
+ if ( pObj->GetNext() )
+ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+ }
+ delete pObj;
+ *(pData + nPos) = pNew;
+ }
+ pNew->SetCachePos( nPos );
+
+ //Anstelle von ToTop, einfach als pFirst einfuegen.
+// ToTop( nPos );
+ if ( pFirst )
+ {
+ if ( pFirst->GetPrev() )
+ { pFirst->GetPrev()->SetNext( pNew );
+ pNew->SetPrev( pFirst->GetPrev() );
+ }
+ pFirst->SetPrev( pNew );
+ pNew->SetNext( pFirst );
+ }
+ else
+ { ASSERT( !pLast, "Last but no First." );
+ pLast = pNew;
+ }
+ if ( pFirst == pRealFirst )
+ pRealFirst = pNew;
+ pFirst = pNew;
+
+ CHECK;
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SwCache::SetLRUOfst()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+void SwCache::SetLRUOfst( const USHORT nOfst )
+{
+ if ( !pRealFirst || ((Count() - aFreePositions.Count()) < nOfst) )
+ return;
+
+ CHECK;
+ pFirst = pRealFirst;
+ for ( USHORT i = 0; i < Count() && i < nOfst; ++i )
+ {
+ if ( pFirst->GetNext() && pFirst->GetNext()->GetNext() )
+ pFirst = pFirst->GetNext();
+ else
+ break;
+ }
+ CHECK;
+}
+
+/*************************************************************************
+|*
+|* SwCacheObj::SwCacheObj()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 24. Nov. 95
+|*
+|*************************************************************************/
+
+
+SwCacheObj::SwCacheObj( const void *pOwn ) :
+ nLock( 0 ),
+ nCachePos( USHRT_MAX ),
+ pNext( 0 ),
+ pPrev( 0 ),
+ pOwner( pOwn )
+{
+}
+
+
+
+SwCacheObj::~SwCacheObj()
+{
+}
+
+/*************************************************************************
+|*
+|* SwCacheObj::SetLock(), Unlock()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+#ifndef PRODUCT
+
+
+
+void SwCacheObj::Lock()
+{
+ ASSERT( nLock < UCHAR_MAX, "To many Locks for CacheObject." );
+ ++nLock;
+}
+
+
+
+void SwCacheObj::Unlock()
+{
+ ASSERT( nLock, "No more Locks available." );
+ --nLock;
+}
+#endif
+
+/*************************************************************************
+|*
+|* SwCacheAccess::Get()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 04. Apr. 95
+|*
+|*************************************************************************/
+
+
+void SwCacheAccess::_Get()
+{
+ ASSERT( !pObj, "SwCacheAcces Obj already available." );
+
+ pObj = NewObj();
+ if ( !rCache.Insert( pObj ) )
+ {
+ delete pObj;
+ pObj = 0;
+ }
+ else
+ pObj->Lock();
+}
+
+/*************************************************************************
+|*
+|* SwCacheAccess::IsAvailable()
+|*
+|* Ersterstellung MA 23. Mar. 94
+|* Letzte Aenderung MA 23. Mar. 94
+|*
+|*************************************************************************/
+
+
+BOOL SwCacheAccess::IsAvailable() const
+{
+ return pObj != 0;
+}
+
+
+
+
+
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
new file mode 100644
index 000000000000..797b78ef5312
--- /dev/null
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * $RCSfile: swrect.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef PRODUCT
+#ifndef _STREAM_HXX //autogen
+#include
+#endif
+#endif
+#include
+#include "swrect.hxx"
+
+
+/*************************************************************************
+|*
+|* SwRect::SwRect()
+|*
+|* Ersterstellung MA 02. Feb. 93
+|* Letzte Aenderung MA 05. Sep. 93
+|*
+|*************************************************************************/
+
+
+
+SwRect::SwRect( const Rectangle &rRect ) :
+ nX( rRect.Left() ),
+ nY( rRect.Top() )
+{
+ nWidth = rRect.Right() == RECT_EMPTY ? 0 :
+ rRect.Right() - rRect.Left() +1;
+ nHeight = rRect.Bottom() == RECT_EMPTY ? 0 :
+ rRect.Bottom() - rRect.Top() + 1;
+}
+
+/*************************************************************************
+|*
+|* SwRect::Center()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+Point SwRect::Center() const
+{
+ return Point( Left() + Width() / 2,
+ Top() + Height() / 2 );
+
+/* Wer ruft schon ein Center auf ein "falsches" Rechteck?
+ const long nRight = Right();
+ const long nBottom= Bottom();
+ return Point( min( Left(), nRight ) + long(abs( (nRight - Left())/2) ),
+ min( Top(), nBottom) + long(abs( (nBottom - Top())/2)));
+*/
+}
+
+/*************************************************************************
+|*
+|* SwRect::Union()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+
+
+
+SwRect& SwRect::Union( const SwRect& rRect )
+{
+ if ( Top() > rRect.Top() )
+ Top( rRect.Top() );
+ if ( Left() > rRect.Left() )
+ Left( rRect.Left() );
+ register long n = rRect.Right();
+ if ( Right() < n )
+ Right( n );
+ n = rRect.Bottom();
+ if ( Bottom() < n )
+ Bottom( n );
+ return *this;
+}
+/*************************************************************************
+|*
+|* SwRect::Intersection(), _Intersection()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 05. Sep. 93
+|*
+|*************************************************************************/
+
+
+
+SwRect& SwRect::Intersection( const SwRect& rRect )
+{
+ //Hat das Teil ueberhaupt Gemeinsamkeiten mit mir?
+ if ( IsOver( rRect ) )
+ {
+ //Bestimmung der kleineren rechten sowie unteren und
+ // der groesseren linken sowie oberen Kante.
+ if ( Left() < rRect.Left() )
+ Left( rRect.Left() );
+ if ( Top() < rRect.Top() )
+ Top( rRect.Top() );
+ register long n = rRect.Right();
+ if ( Right() > n )
+ Right( n );
+ n = rRect.Bottom();
+ if ( Bottom() > n )
+ Bottom( n );
+ }
+ else
+ //Def.: Bei einer leeren Intersection wird nur die SSize genullt.
+ nHeight = nWidth = 0;
+
+ return *this;
+}
+
+
+
+SwRect& SwRect::_Intersection( const SwRect& rRect )
+{
+ //Bestimmung der kleineren rechten sowie unteren und
+ // der groesseren linken sowie oberen Kante.
+ if ( Left() < rRect.Left() )
+ Left( rRect.Left() );
+ if ( Top() < rRect.Top() )
+ Top( rRect.Top() );
+ register long n = rRect.Right();
+ if ( Right() > n )
+ Right( n );
+ n = rRect.Bottom();
+ if ( Bottom() > n )
+ Bottom( n );
+
+ return *this;
+}
+/*************************************************************************
+|*
+|* SwRect::IsInside()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+
+
+
+BOOL SwRect::IsInside( const SwRect& rRect ) const
+{
+ const long nRight = Right();
+ const long nBottom = Bottom();
+ const long nrRight = rRect.Right();
+ const long nrBottom= rRect.Bottom();
+ return (Left() <= rRect.Left()) && (rRect.Left()<= nRight) &&
+ (Left() <= nrRight) && (nrRight <= nRight) &&
+ (Top() <= rRect.Top()) && (rRect.Top() <= nBottom) &&
+ (Top() <= nrBottom) && (nrBottom <= nBottom);
+}
+
+
+
+BOOL SwRect::IsInside( const Point& rPoint ) const
+{
+ return (Left() <= rPoint.X())
+ && (Top() <= rPoint.Y())
+ && (Right() >= rPoint.X())
+ && (Bottom()>= rPoint.Y());
+}
+/* -----------------------------11.04.00 15:46--------------------------------
+ mouse moving of table borders
+ ---------------------------------------------------------------------------*/
+BOOL SwRect::IsNear( const Point& rPoint, long nTolerance ) const
+{
+ return IsInside(rPoint) ||
+ (((Left() - nTolerance) <= rPoint.X())
+ && ((Top() - nTolerance) <= rPoint.Y())
+ && ((Right() + nTolerance) >= rPoint.X())
+ && ((Bottom() + nTolerance)>= rPoint.Y()));
+}
+
+/*************************************************************************
+|*
+|* SwRect::IsOver()
+|*
+|* Ersterstellung MA 25. Feb. 94
+|* Letzte Aenderung MA 27. Jun. 96
+|*
+|*************************************************************************/
+
+
+
+BOOL SwRect::IsOver( const SwRect& rRect ) const
+{
+ return (Top() <= rRect.Bottom())
+ && (Left() <= rRect.Right())
+ && (Right() >= rRect.Left())
+ && (Bottom()>= rRect.Top()) ? TRUE : FALSE;
+}
+
+/*************************************************************************
+|*
+|* SwRect::Justify()
+|*
+|* Ersterstellung MA 10. Oct. 94
+|* Letzte Aenderung MA 23. Oct. 96
+|*
+|*************************************************************************/
+
+
+
+void SwRect::Justify()
+{
+ if ( nHeight < 0 )
+ {
+ nY = nY + nHeight + 1;
+ nHeight = -nHeight;
+ }
+ if ( nWidth < 0 )
+ {
+ nX = nX + nWidth + 1;
+ nWidth = -nWidth;
+ }
+}
+
+
+#ifndef PRODUCT
+/*************************************************************************
+ * operator<<( ostream&, SwRect&)
+ *************************************************************************/
+
+
+
+SvStream &operator<<( SvStream &rStream, const SwRect &rRect )
+{
+ rStream << '[' << rRect.Top() << '/' << rRect.Left()
+ << ',' << rRect.Width() << 'x' << rRect.Height() << "] ";
+ return rStream;
+}
+#endif
+
+
diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx
new file mode 100644
index 000000000000..6961d8efe354
--- /dev/null
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -0,0 +1,293 @@
+/*************************************************************************
+ *
+ * $RCSfile: swregion.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+
+#ifndef _DEBUG_HXX //autogen
+#include
+#endif
+#include "swtypes.hxx"
+#include "swrect.hxx"
+#include "swregion.hxx"
+
+
+SV_IMPL_VARARR( SwRects, SwRect );
+
+/*************************************************************************
+|*
+|* SwRegionRects::SwRegionRects()
+|*
+|* Ersterstellung MA 28. Oct. 92
+|* Letzte Aenderung MA 01. Feb. 93
+|*
+|*************************************************************************/
+
+SwRegionRects::SwRegionRects( const SwRect &rStartRect, USHORT nInit,
+ USHORT nGrow ) :
+ SwRects( (BYTE)nInit, (BYTE)nGrow ),
+ aOrigin( rStartRect )
+{
+ Insert( aOrigin, 0 );
+}
+
+/*************************************************************************
+ * inline InsertRect()
+ *
+ * InsertRect() wird nur von operator-=() gerufen.
+ * Wenn bDel == TRUE ist, dann wird das Rect an der Position nPos mit
+ * rRect ueberschrieben, ansonsten wird rRect hinten angehaengt.
+ *************************************************************************/
+
+inline void SwRegionRects::InsertRect( const SwRect &rRect, const USHORT nPos,
+ FASTBOOL &rDel )
+{
+ if( rDel )
+ {
+ *(pData+nPos) = rRect;
+ rDel = FALSE;
+ }
+ else
+ Insert( rRect, Count() );
+}
+
+/*************************************************************************
+|*
+|* SwRegionRects::operator-=()
+|*
+|* Beschreibung Alle Ueberschneidungen der Rechtecke, die sich
+|* gerade im Array befinden, mit dem uebergebenen Rechteck werden
+|* entfernt.
+|* Dazu muessen die vorhandenen Rechtecke entweder aufgeteilt oder
+|* geloescht werden.
+|* Ersterstellung MA 28. Oct. 92
+|* Letzte Aenderung MA 09. Sep. 93
+|*
+|*************************************************************************/
+
+void SwRegionRects::operator-=( const SwRect &rRect )
+{
+ USHORT nMax = Count();
+ for ( USHORT i = 0; i < nMax; ++i )
+ {
+ if ( rRect.IsOver( *(pData+i) ) )
+ {
+ SwRect aTmp( *(pData+i) );
+ SwRect aInter( aTmp );
+ aInter._Intersection( rRect );
+
+ // Das erste Rect, das wir inserten wollen, nimmt die
+ // Stelle von i ein. So ersparen wir uns das Delete().
+ FASTBOOL bDel = TRUE;
+
+ //Jetzt aufteilen das Teil: Es sollen diejenigen Rechtecke
+ //zurueckbleiben, die im alten aber nicht im neuen liegen.
+ //Sprich alle Rechtecke die im alten aber nicht in der Intersection
+ //liegen.
+ long nTmp;
+ if ( 0 < (nTmp = aInter.Top() - aTmp.Top()) )
+ {
+ const long nOldVal = aTmp.Height();
+ aTmp.SSize().Height() = nTmp;
+ InsertRect( aTmp, i, bDel );
+ aTmp.Height( nOldVal );
+ }
+
+ aTmp.Top( aInter.Top() + aInter.Height() );
+ if ( aTmp.Height() > 0 )
+ InsertRect( aTmp, i, bDel );
+
+ aTmp.Top( aInter.Top() );
+ aTmp.Bottom( aInter.Bottom() );
+ if ( 0 < (nTmp = aInter.Left() - aTmp.Left()) )
+ {
+ const long nOldVal = aTmp.Width();
+ aTmp.Width( nTmp );
+ InsertRect( aTmp, i, bDel );
+ aTmp.Width( nOldVal );
+ }
+
+ aTmp.Left( aInter.Left() + aInter.Width() ); //+1?
+ if ( aTmp.Width() > 0 )
+ InsertRect( aTmp, i, bDel );
+
+ if( bDel )
+ {
+ Remove( i );
+ --i; //Damit wir keinen uebergehen.
+ --nMax; //Damit wir keinen zuviel verarbeiten.
+ }
+ }
+ }
+
+}
+
+/*************************************************************************
+ * SwRegionRects::Invert()
+ *
+ * Bezugspunkt ist aOrigin, das Original-SRectangle.
+ * Aus Loechern werden Flaechen, aus Flaechen werden Loecher.
+ * Ein Hinweis: Wenn keine Rects abgezogen wurden, so ist das enthaltene
+ * Rechteck identisch mit aOrigin. Nach Invert() besteht die Region aus
+ * einem Null-SRectangle.
+ *************************************************************************/
+
+void SwRegionRects::Invert()
+{
+ // Nicht besonders elegant und schnell, aber wirkungsvoll:
+ // Wir legen eine weitere Region an und ziehen alle Flaechen ab,
+ // die in uns noch uebrig geblieben sind. Danach werden alle
+ // Werte uebertragen.
+
+ // Um unuetze Speicheranforderungen zu vermeiden versuchen wir die
+ // iniale Groesse moeglichst brauchbar anzulegen:
+ // Anzahl der Rechtecke in der Region * 2 + 2
+ // plus zwei um den Sonderfall eines einzelnen Loches (macht vier
+ // Rechtecke im inversen Fall) abzudecken.
+
+ SwRegionRects aInvRegion( aOrigin, Count()*2+2 );
+ const SwRect *pDat = GetData();
+ for( USHORT i = 0; i < Count(); ++pDat, ++i )
+ aInvRegion -= *pDat;
+
+ USHORT nCpy = Count(), nDel = 0;
+ if( aInvRegion.Count() < Count() )
+ {
+ nDel = Count() - aInvRegion.Count();
+ nCpy = aInvRegion.Count();
+ }
+ // alle vorhandenen ueberschreiben
+ memcpy( pData, aInvRegion.GetData(), nCpy * sizeof( SwRect ));
+
+ if( nCpy < aInvRegion.Count() )
+ Insert( &aInvRegion, nCpy, nCpy );
+ else if( nDel )
+ Remove( nCpy, nDel );
+}
+/*************************************************************************
+|*
+|* SwRegionRects::Compress()
+|*
+|* Beschreibung Zusammenfassen von benachbarten Rechtecken.
+|* Ersterstellung MA 16. Apr. 93
+|* Letzte Aenderung MA 21. Apr. 93
+|*
+|*************************************************************************/
+inline SwTwips CalcArea( const SwRect &rRect )
+{
+ return rRect.Width() * rRect.Height();
+}
+
+
+#pragma optimize("e",off)
+void SwRegionRects::Compress( BOOL bFuzzy )
+{
+ for ( int i = 0; i < Count(); ++i )
+ {
+ for ( int j = i+1; j < Count(); ++j )
+ {
+ //Wenn zwei Rechtecke ineinanderliegen, so ist eins davon
+ //uberfluessig.
+ if ( (*(pData + i)).IsInside( *(pData + j) ) )
+ {
+ Remove( j, 1 );
+ --j;
+ }
+ else if ( (*(pData + j)).IsInside( *(pData + i) ) )
+ {
+ *(pData + i) = *(pData + j);
+ Remove( j, 1 );
+ i = -1;
+ break;
+ }
+ else
+ {
+ //Wenn zwei Rechtecke dieselbe Flaeche haben wie deren
+ //Union abzueglich deren Intersection, so ist eines
+ //davon ueberfluessig.
+ //Um moeglichst viel zusammenzufassen und in der Folge
+ //moeglichst wenig einzelne Paints zu haben darf die Flaeche
+ //der Union ruhig ein bischen groesser sein
+ //( 9622 * 141.5 = 1361513 ~= ein virtel Zentimeter ueber die
+ // Breite einer DINA4 Seite)
+ const long nFuzzy = bFuzzy ? 1361513 : 0;
+ SwRect aUnion( *(pData + i) );aUnion.Union( *(pData + j) );
+ SwRect aInter( *(pData + i) );aInter.Intersection( *(pData + j));
+ if ( (::CalcArea( *(pData + i) ) +
+ ::CalcArea( *(pData + j) ) + nFuzzy) >=
+ (::CalcArea( aUnion ) - CalcArea( aInter )) )
+ {
+ *(pData + i) = aUnion;
+ Remove( j, 1 );
+ i = -1;
+ break;
+ }
+ }
+ }
+ }
+}
+#pragma optimize("",on)
+
+
diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx
new file mode 100644
index 000000000000..68b12f26b21f
--- /dev/null
+++ b/sw/source/core/bastyp/swtypes.cxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * $RCSfile: swtypes.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _SV_WINDOW_HXX //autogen
+#include
+#endif
+#ifndef _SV_GRAPH_HXX //autogen
+#include
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include
+#endif
+#ifndef _OFA_OSPLCFG_HXX //autogen
+#include
+#endif
+
+#ifndef _SFXINIMGR_HXX
+#include
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include
+#endif
+#ifndef _COM_SUN_STAR_LINGUISTIC_XSPELLCHECKER1_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_LINGUISTIC_XHYPHENATOR_HPP_
+#include
+#endif
+#ifndef _UNO_LINGU_HXX
+#include
+#endif
+#ifndef _COM_SUN_STAR_LINGUISTIC_XTHESAURUS_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include
+#endif
+
+#ifndef _PAGEFRM_HXX
+#include
+#endif
+#ifndef _SWATRSET_HXX
+#include
+#endif
+#ifndef _FRMFMT_HXX
+#include
+#endif
+#ifndef _FRMTOOL_HXX
+#include
+#endif
+#ifndef _NDTXT_HXX
+#include
+#endif
+#ifndef _UNDOBJ_HXX
+#include
+#endif
+#ifndef _SWTABLE_HXX
+#include
+#endif
+#ifndef _VISCRS_HXX
+#include
+#endif
+#ifndef _FNTCACHE_HXX
+#include
+#endif
+#ifndef _SWFNTCCH_HXX
+#include
+#endif
+#ifndef _HFFRM_HXX
+#include
+#endif
+#ifndef _COLFRM_HXX
+#include
+#endif
+#ifndef _BODYFRM_HXX
+#include
+#endif
+#ifndef _TABFRM_HXX
+#include
+#endif
+#ifndef _TXTFRM_HXX
+#include
+#endif
+#ifndef _SWTBLFMT_HXX
+#include
+#endif
+#ifndef _ROWFRM_HXX
+#include
+#endif
+#ifndef _CELLFRM_HXX
+#include
+#endif
+#ifndef _SECTFRM_HXX
+#include
+#endif
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+
+#ifndef _GRFCACHE_HXX
+#include
+#endif
+
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::utl;
+
+#ifndef PROFILE
+// Code zum Initialisieren von Statics im eigenen Code-Segment
+#pragma code_seg( "SWSTATICS" )
+#endif
+
+ByteString aEmptyByteStr; // Konstante Strings
+String aEmptyStr; // Konstante Strings
+String aDotStr('.'); // Konstante Strings
+
+IMPL_FIXEDMEMPOOL_NEWDEL( SwAttrSet, 25, 25 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwStartNode, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwEndNode, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableBox, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwUndoDelete, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwUndoInsert, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwPaM, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwCursor, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwShellCrsr, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTxtNode, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwpHints, 25, 25 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFntObj, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFontObj, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFrmFmt, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrmFmt, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwDrawFrmFmt, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwBorderAttrs, 100, 100 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwCellFrm, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwRowFrm, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwColumnFrm, 40, 40 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwSectionFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTabFrm, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwPageFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwBodyFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwHeaderFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwFooterFrm, 20, 20 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTxtFrm, 50, 50 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableFmt, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableLineFmt, 10, 10 )
+IMPL_FIXEDMEMPOOL_NEWDEL( SwTableBoxFmt, 50, 50 )
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+
+IMPL_FIXEDMEMPOOL_NEWDEL( SwGraphicCacheObj, 50, 50 )
+
+#endif
+
+
+#ifndef PROFILE
+#pragma code_seg()
+#endif
+
+Size GetGraphicSizeTwip( const Graphic& rGraphic, OutputDevice* pOutDev )
+{
+ const MapMode aMapTwip( MAP_TWIP );
+ Size aSize( rGraphic.GetPrefSize() );
+ if( MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit() )
+ {
+ if( !pOutDev )
+ pOutDev = Application::GetDefaultDevice();
+ aSize = pOutDev->PixelToLogic( aSize, aMapTwip );
+ }
+ else
+ aSize = OutputDevice::LogicToLogic( aSize,
+ rGraphic.GetPrefMapMode(), aMapTwip );
+ return aSize;
+}
+
+
+uno::Reference< linguistic::XSpellChecker1 > GetSpellChecker()
+{
+ return LinguMgr::GetSpellChecker();
+}
+
+uno::Reference< linguistic::XHyphenator > GetHyphenator()
+{
+ return LinguMgr::GetHyphenator();
+}
+
+uno::Reference< linguistic::XThesaurus > GetThesaurus()
+{
+ return LinguMgr::GetThesaurus();
+}
+
+uno::Reference< linguistic::XDictionaryList > GetDictionaryList()
+{
+ return LinguMgr::GetDictionaryList();
+}
+
+uno::Reference< beans::XPropertySet > GetLinguPropertySet()
+{
+ return LinguMgr::GetLinguPropertySet();
+}
+
+
diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx
new file mode 100644
index 000000000000..2fcd7ae1b04b
--- /dev/null
+++ b/sw/source/core/bastyp/tabcol.cxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabcol.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include "tabcol.hxx"
+
+SwTabCols::SwTabCols( USHORT nSize )
+ : SvLongs( (BYTE)nSize ),
+ aHidden( (BYTE)nSize ),
+ nLeftMin( 0 ),
+ nLeft( 0 ),
+ nRight( 0 ),
+ nRightMax( 0 )
+{
+}
+
+SwTabCols::SwTabCols( const SwTabCols& rCpy )
+ : SvLongs( (BYTE)rCpy.Count(), 1 ),
+ aHidden( (BYTE)rCpy.Count(), 1 ),
+ nLeftMin( rCpy.GetLeftMin() ),
+ nLeft( rCpy.GetLeft() ),
+ nRight( rCpy.GetRight() ),
+ nRightMax( rCpy.GetRightMax() )
+{
+ Insert( &rCpy, 0 );
+ aHidden.Insert( &rCpy.GetHidden(), 0 );
+}
+
+SwTabCols &SwTabCols::operator=( const SwTabCols& rCpy )
+{
+ nLeftMin = rCpy.GetLeftMin();
+ nLeft = rCpy.GetLeft();
+ nRight = rCpy.GetRight();
+ nRightMax= rCpy.GetRightMax();
+
+ Remove( 0, Count() );
+ Insert( &rCpy, 0 );
+
+ aHidden.Remove( 0, aHidden.Count() );
+ aHidden.Insert( &rCpy.GetHidden(), 0 );
+
+ return *this;
+}
+
+BOOL SwTabCols::operator==( const SwTabCols& rCmp ) const
+{
+ if ( !(nLeftMin == rCmp.GetLeftMin() &&
+ nLeft == rCmp.GetLeft() &&
+ nRight == rCmp.GetRight() &&
+ nRightMax== rCmp.GetRightMax()&&
+ Count()== rCmp.Count()) )
+ return FALSE;
+ for ( USHORT i = 0; i < Count(); ++i )
+ if ( operator[](i) != rCmp[i] )
+ return FALSE;
+
+ for ( i = 0; i < aHidden.Count(); ++i )
+ if ( aHidden[i] != rCmp.IsHidden( i ) )
+ return FALSE;
+
+ return TRUE;
+}
+
+
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
new file mode 100644
index 000000000000..2e0b19b37603
--- /dev/null
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * $RCSfile: bookmrk.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include "swtypes.hxx"
+#include "doc.hxx"
+#include "pam.hxx"
+
+#include "bookmrk.hxx"
+#include "swserv.hxx"
+
+#ifndef _ERRHDL_HXX //autogen
+#include
+#endif
+
+SO2_IMPL_REF( SwServerObject )
+
+TYPEINIT1( SwBookmark, SwModify ); //rtti
+
+
+SwBookmark::SwBookmark(const SwPosition& aPos)
+ : SwModify( 0 ),
+ aStartMacro( aEmptyStr, aEmptyStr ),
+ aEndMacro ( aEmptyStr, aEmptyStr ),
+ pPos2( 0 ),
+ eMarkType( BOOKMARK )
+{
+ pPos1 = new SwPosition( aPos );
+}
+
+
+SwBookmark::SwBookmark(const SwPosition& aPos, const KeyCode& rCode,
+ const String& rName, const String& rShortName )
+ : SwModify( 0 ),
+ aStartMacro( aEmptyStr, aEmptyStr ),
+ aEndMacro ( aEmptyStr, aEmptyStr ),
+ aCode(rCode),
+ aName(rName),
+ aShortName(rShortName),
+ pPos2( 0 ),
+ eMarkType( BOOKMARK )
+{
+ pPos1 = new SwPosition(aPos);
+}
+
+// Beim Loeschen von Text werden Bookmarks mitgeloescht!
+
+
+SwBookmark::~SwBookmark()
+{
+ // falls wir noch der DDE-Bookmark sind, dann muss der aus dem
+ // Clipboard ausgetragen werden. Wird automatisch ueber DataChanged
+ // ausgeloest.
+ if( refObj.Is() )
+ {
+ if( DDE_BOOKMARK == eMarkType && refObj->GetSelectorCount() )
+ {
+ SvData aSvData;
+ refObj->DataChanged( aSvData );
+ }
+ refObj->SetNoServer();
+ }
+
+ delete pPos1;
+ if( pPos2 )
+ delete pPos2;
+}
+
+// Vergleiche auf Basis der Dokumentposition
+
+BOOL SwBookmark::operator<(const SwBookmark &rBM) const
+{
+ const SwPosition* pThisPos = ( !pPos2 || *pPos1 <= *pPos2 ) ? pPos1 : pPos2;
+ const SwPosition* pBMPos = ( !rBM.pPos2 || *rBM.pPos1 <= *rBM.pPos2 )
+ ? rBM.pPos1 : rBM.pPos2;
+
+ return *pThisPos < *pBMPos;
+}
+
+BOOL SwBookmark::operator==(const SwBookmark &rBM) const
+{
+ return (this == &rBM);
+}
+
+BOOL SwBookmark::IsEqualPos( const SwBookmark &rBM ) const
+{
+ const SwPosition* pThisPos = ( !pPos2 || *pPos1 <= *pPos2 ) ? pPos1 : pPos2;
+ const SwPosition* pBMPos = ( !rBM.pPos2 || *rBM.pPos1 <= *rBM.pPos2 )
+ ? rBM.pPos1 : rBM.pPos2;
+
+ return *pThisPos == *pBMPos;
+}
+
+void SwBookmark::SetRefObject( SvPseudoObject* pObj )
+{
+ refObj = pObj;
+}
+
+
+SwMark::SwMark( const SwPosition& aPos,
+ const KeyCode& rCode,
+ const String& rName,
+ const String& rShortName )
+ : SwBookmark( aPos, rCode, rName, rShortName )
+{
+ eMarkType = MARK;
+}
+
+SwUNOMark::SwUNOMark( const SwPosition& aPos,
+ const KeyCode& rCode,
+ const String& rName,
+ const String& rShortName )
+ : SwBookmark( aPos, rCode, rName, rShortName )
+{
+ eMarkType = UNO_BOOKMARK;
+}
+
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
new file mode 100644
index 000000000000..f47953c016c3
--- /dev/null
+++ b/sw/source/core/crsr/callnk.cxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * $RCSfile: callnk.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:16 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _HINTIDS_HXX
+#include
+#endif
+
+#ifndef _FMTCNTNT_HXX //autogen
+#include
+#endif
+#ifndef _TXATBASE_HXX //autogen
+#include
+#endif
+#ifndef _FRMATR_HXX
+#include
+#endif
+#ifndef _VISCRS_HXX
+#include
+#endif
+#ifndef _CALLNK_HXX
+#include
+#endif
+#ifndef _CRSRSH_HXX
+#include
+#endif
+#ifndef _DOC_HXX
+#include
+#endif
+#ifndef _FRMFMT_HXX
+#include
+#endif
+#ifndef _TXTFRM_HXX
+#include
+#endif
+#ifndef _NDTXT_HXX
+#include
+#endif
+#ifndef _FLYFRM_HXX
+#include
+#endif
+
+
+SwCallLink::SwCallLink( SwCrsrShell & rSh, ULONG nAktNode, xub_StrLen nAktCntnt,
+ BYTE nAktNdTyp, long nLRPos )
+ : rShell( rSh ), nNode( nAktNode ), nCntnt( nAktCntnt ),
+ nNdTyp( nAktNdTyp ), nLeftFrmPos( nLRPos )
+{
+}
+
+
+SwCallLink::SwCallLink( SwCrsrShell & rSh )
+ : rShell( rSh )
+{
+ // SPoint-Werte vom aktuellen Cursor merken
+ SwPaM* pCrsr = rShell.IsTableMode() ? rShell.GetTblCrs() : rShell.GetCrsr();
+ SwNode& rNd = pCrsr->GetPoint()->nNode.GetNode();
+ nNode = rNd.GetIndex();
+ nCntnt = pCrsr->GetPoint()->nContent.GetIndex();
+ nNdTyp = rNd.GetNodeType();
+
+ if( ND_TEXTNODE & nNdTyp )
+ nLeftFrmPos = SwCallLink::GetFrm( (SwTxtNode&)rNd, nCntnt,
+ !rShell.ActionPend() );
+ else
+ {
+ nLeftFrmPos = 0;
+
+ // eine Sonderbehandlung fuer die SwFeShell: diese setzt beim Loeschen
+ // der Kopf-/Fusszeile, Fussnoten den Cursor auf NULL (Node + Content)
+ // steht der Cursor auf keinem CntntNode, wird sich das im NdType
+ // gespeichert.
+ if( ND_CONTENTNODE & nNdTyp )
+ nNdTyp = 0;
+ }
+}
+
+
+SwCallLink::~SwCallLink()
+{
+ if( !nNdTyp || !rShell.bCallChgLnk ) // siehe ctor
+ return ;
+
+ // wird ueber Nodes getravellt, Formate ueberpruefen und im neuen
+ // Node wieder anmelden
+ SwPaM* pCurCrsr = rShell.IsTableMode() ? rShell.GetTblCrs() : rShell.GetCrsr();
+ SwCntntNode * pCNd = pCurCrsr->GetCntntNode();
+ if( !pCNd )
+ return;
+
+ xub_StrLen nCmp, nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
+ USHORT nNdWhich = pCNd->GetNodeType();
+ ULONG nAktNode = pCurCrsr->GetPoint()->nNode.GetIndex();
+
+ // melde die Shell beim akt. Node als abhaengig an, dadurch koennen
+ // alle Attribut-Aenderungen ueber den Link weiter gemeldet werden.
+ pCNd->Add( &rShell );
+
+ if( nNdTyp != nNdWhich || nNode != nAktNode )
+ {
+ /* immer, wenn zwischen Nodes gesprungen wird, kann es
+ * vorkommen, das neue Attribute gelten; die Text-Attribute.
+ * Es muesste also festgestellt werden, welche Attribute
+ * jetzt gelten; das kann auch gleich der Handler machen
+ */
+ rShell.CallChgLnk();
+ }
+ else if( rShell.aChgLnk.IsSet() && ND_TEXTNODE == nNdWhich &&
+ nCntnt != nAktCntnt )
+ {
+ // nur wenn mit Left/right getravellt, dann Text-Hints pruefen
+ // und sich nicht der Frame geaendert hat (Spalten!)
+ if( nLeftFrmPos == SwCallLink::GetFrm( (SwTxtNode&)*pCNd, nAktCntnt,
+ !rShell.ActionPend() ) &&
+ (( nCmp = nCntnt ) + 1 == nAktCntnt || // Right
+ nCntnt -1 == ( nCmp = nAktCntnt )) ) // Left
+ {
+ if ( ((SwTxtNode*)pCNd)->HasHints() )
+ {
+ if( nCmp == nAktCntnt && pCurCrsr->HasMark() ) // left & Sele
+ ++nCmp;
+
+ const SwpHints &rHts = ((SwTxtNode*)pCNd)->GetSwpHints();
+ USHORT n;
+ xub_StrLen nStart;
+ const xub_StrLen *pEnd;
+
+ for( n = 0; n < rHts.Count(); n++ )
+ {
+ const SwTxtAttr* pHt = rHts[ n ];
+ pEnd = pHt->GetEnd();
+ nStart = *pHt->GetStart();
+
+ // nur Start oder Start und Ende gleich, dann immer
+ // beim Ueberlaufen von Start callen
+ if( ( !pEnd || ( nStart == *pEnd ) ) &&
+ ( nStart == nCntnt || nStart == nAktCntnt) )
+ {
+ rShell.CallChgLnk();
+ return;
+ }
+
+ // hat das Attribut einen Bereich und dieser nicht leer
+ else if( pEnd && nStart < *pEnd &&
+ // dann teste, ob ueber Start/Ende getravellt wurde
+ ( nStart == nCmp ||
+ ( pHt->DontExpand() ? nCmp == *pEnd-1
+ : nCmp == *pEnd ) ))
+ {
+ rShell.CallChgLnk();
+ return;
+ }
+ nStart = 0;
+ }
+ }
+ }
+ else
+ /* wenn mit Home/End/.. mehr als 1 Zeichen getravellt, dann
+ * immer den ChgLnk rufen, denn es kann hier nicht
+ * festgestellt werden, was sich geaendert; etwas kann
+ * veraendert sein.
+ */
+ rShell.CallChgLnk();
+ }
+
+ const SwFrm* pFrm;
+ const SwFlyFrm *pFlyFrm;
+ if( !rShell.ActionPend() && 0 != ( pFrm = pCNd->GetFrm(0,0,FALSE) ) &&
+ 0 != ( pFlyFrm = pFrm->FindFlyFrm() ) && !rShell.IsTableMode() )
+ {
+ const SwNodeIndex* pIndex = pFlyFrm->GetFmt()->GetCntnt().GetCntntIdx();
+ ASSERT( pIndex, "Fly ohne Cntnt" );
+ const SwNode& rStNd = pIndex->GetNode();
+
+ if( rStNd.EndOfSectionNode()->StartOfSectionIndex() > nNode ||
+ nNode > rStNd.EndOfSectionIndex() )
+ rShell.GetFlyMacroLnk().Call( (void*)pFlyFrm->GetFmt() );
+ }
+}
+
+long SwCallLink::GetFrm( SwTxtNode& rNd, xub_StrLen nCntPos, BOOL bCalcFrm )
+{
+ SwTxtFrm* pFrm = (SwTxtFrm*)rNd.GetFrm(0,0,bCalcFrm), *pNext = pFrm;
+ if ( pFrm && !pFrm->IsHiddenNow() )
+ {
+ if( pFrm->HasFollow() )
+ while( 0 != ( pNext = (SwTxtFrm*)pFrm->GetFollow() ) &&
+ nCntPos >= pNext->GetOfst() )
+ pFrm = pNext;
+
+ return pFrm->Frm().Left();
+ }
+ return 0;
+}
+
+/*---------------------------------------------------------------------*/
+
+
+SwChgLinkFlag::SwChgLinkFlag( SwCrsrShell& rShell )
+ : rCrsrShell( rShell ), bOldFlag( rShell.bCallChgLnk ), nLeftFrmPos( 0 )
+{
+ rCrsrShell.bCallChgLnk = FALSE;
+ if( bOldFlag && !rCrsrShell.pTblCrsr )
+ {
+ SwNode* pNd = rCrsrShell.pCurCrsr->GetNode();
+ if( ND_TEXTNODE & pNd->GetNodeType() )
+ nLeftFrmPos = SwCallLink::GetFrm( (SwTxtNode&)*pNd,
+ rCrsrShell.pCurCrsr->GetPoint()->nContent.GetIndex(),
+ !rCrsrShell.ActionPend() );
+ }
+}
+
+
+SwChgLinkFlag::~SwChgLinkFlag()
+{
+ rCrsrShell.bCallChgLnk = bOldFlag;
+ if( bOldFlag && !rCrsrShell.pTblCrsr )
+ {
+ // die Spalten Ueberwachung brauchen wir immer!!!
+ SwNode* pNd = rCrsrShell.pCurCrsr->GetNode();
+ if( ND_TEXTNODE & pNd->GetNodeType() &&
+ nLeftFrmPos != SwCallLink::GetFrm( (SwTxtNode&)*pNd,
+ rCrsrShell.pCurCrsr->GetPoint()->nContent.GetIndex(),
+ !rCrsrShell.ActionPend() ))
+ {
+ /* immer, wenn zwischen Frames gesprungen wird, gelten
+ * neue Attribute. Es muesste also festgestellt werden, welche
+ * Attribute jetzt gelten; das kann gleich der Handler machen.
+ * Diesen direkt rufen !!!
+ */
+ rCrsrShell.aChgLnk.Call( &rCrsrShell );
+ rCrsrShell.bChgCallFlag = FALSE; // Flag zuruecksetzen
+ }
+ }
+}
+
+
+
+
diff --git a/sw/source/core/crsr/callnk.hxx b/sw/source/core/crsr/callnk.hxx
new file mode 100644
index 000000000000..689b047e0fa2
--- /dev/null
+++ b/sw/source/core/crsr/callnk.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * $RCSfile: callnk.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CALLNK_HXX
+#define _CALLNK_HXX
+
+#include
+
+class SwCrsrShell;
+class SwTxtNode;
+
+class SwCallLink
+{
+public:
+ SwCrsrShell & rShell;
+ ULONG nNode;
+ xub_StrLen nCntnt;
+ BYTE nNdTyp;
+ long nLeftFrmPos;
+
+ SwCallLink( SwCrsrShell & rSh );
+ SwCallLink( SwCrsrShell & rSh, ULONG nAktNode, xub_StrLen nAktCntnt,
+ BYTE nAktNdTyp, long nLRPos );
+ ~SwCallLink();
+
+ static long GetFrm( SwTxtNode& rNd, xub_StrLen nCntPos, BOOL bCalcFrm );
+};
+
+
+
+#endif // _CALLNK_HXX
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
new file mode 100644
index 000000000000..e7e70afb7bb0
--- /dev/null
+++ b/sw/source/core/crsr/crbm.cxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * $RCSfile: crbm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#include "doc.hxx"
+#include "crsrsh.hxx"
+#include "ndtxt.hxx"
+#ifndef _DOCARY_HXX
+#include
+#endif
+
+#include "bookmrk.hxx"
+#include "callnk.hxx"
+#include "swcrsr.hxx"
+
+
+/*
+ * Methoden der SwCrsrShell fuer Bookmark
+ */
+
+
+// am CurCrsr.SPoint
+FASTBOOL SwCrsrShell::SetBookmark( const KeyCode& rCode, const String& rName,
+ const String& rShortName, BOOKMARK_TYPE eMark )
+{
+ StartAction();
+ FASTBOOL bRet = 0 != pDoc->MakeBookmark( *GetCrsr(), rCode, rName,
+ rShortName, eMark);
+ EndAction();
+ return bRet;
+}
+// setzt CurCrsr.SPoint
+
+
+FASTBOOL SwCrsrShell::GotoBookmark(USHORT nPos, BOOL bAtStart)
+{
+ // Crsr-Moves ueberwachen, evt. Link callen
+ FASTBOOL bRet = TRUE;
+ SwCallLink aLk( *this );
+
+ SwBookmark* pBkmk = pDoc->GetBookmarks()[ nPos ];
+ SwCursor* pCrsr = GetSwCrsr();
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ if( pBkmk->GetOtherPos() )
+ {
+ if( bAtStart )
+ *pCrsr->GetPoint() = *pBkmk->GetOtherPos() < pBkmk->GetPos()
+ ? *pBkmk->GetOtherPos()
+ : pBkmk->GetPos();
+ else
+ *pCrsr->GetPoint() = *pBkmk->GetOtherPos() > pBkmk->GetPos()
+ ? *pBkmk->GetOtherPos()
+ : pBkmk->GetPos();
+ }
+ else
+ *pCrsr->GetPoint() = pBkmk->GetPos();
+
+ if( pCrsr->IsSelOvr( SELOVER_CHECKNODESSECTION | SELOVER_TOGGLE ) )
+ {
+ pCrsr->DeleteMark();
+ pCrsr->RestoreSavePos();
+ bRet = FALSE;
+ }
+ else
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::GotoBookmark(USHORT nPos)
+{
+ // Crsr-Moves ueberwachen, evt. Link callen
+ FASTBOOL bRet = TRUE;
+ SwCallLink aLk( *this );
+ SwBookmark* pBkmk = pDoc->GetBookmarks()[ nPos ];
+ SwCursor* pCrsr = GetSwCrsr();
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ *pCrsr->GetPoint() = pBkmk->GetPos();
+ if( pBkmk->GetOtherPos() )
+ {
+ pCrsr->SetMark();
+ *pCrsr->GetMark() = *pBkmk->GetOtherPos();
+ if( *pCrsr->GetMark() > *pCrsr->GetPoint() )
+ pCrsr->Exchange();
+ }
+
+ if( pCrsr->IsSelOvr( SELOVER_CHECKNODESSECTION | SELOVER_TOGGLE ) )
+ {
+ pCrsr->DeleteMark();
+ pCrsr->RestoreSavePos();
+ bRet = FALSE;
+ }
+ else
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+// TRUE, wenn's noch eine gab
+
+
+FASTBOOL SwCrsrShell::GoNextBookmark()
+{
+ SwBookmark aBM(*GetCrsr()->GetPoint());
+ USHORT nPos;
+ const SwBookmarks& rBkmks = pDoc->GetBookmarks();
+ rBkmks.Seek_Entry( &aBM, &nPos );
+ if ( nPos == rBkmks.Count() )
+ return FALSE;
+
+ // alle die Inhaltlich auf der gleichen Position stehen, ueberspringen
+ while( aBM.IsEqualPos( *rBkmks[ nPos ] ))
+ if( ++nPos == rBkmks.Count() )
+ return FALSE;
+
+ while( !GotoBookmark( nPos ))
+ if( ++nPos == rBkmks.Count() )
+ return FALSE;
+
+ return TRUE;
+}
+
+
+FASTBOOL SwCrsrShell::GoPrevBookmark()
+{
+ const SwBookmarks& rBkmks = pDoc->GetBookmarks();
+ if ( !rBkmks.Count() )
+ return FALSE;
+
+ USHORT nPos;
+ SwCursor* pCrsr = GetSwCrsr();
+ SwBookmark aBM( *pCrsr->GetPoint() );
+ rBkmks.Seek_Entry( &aBM, &nPos );
+
+ const SwBookmark* pBkmk;
+ // alle die Inhaltlich auf der gleichen Position stehen, ueberspringen
+ do {
+ if ( nPos == 0 )
+ return FALSE;
+ } while( aBM < *(pBkmk = rBkmks[--nPos]) || aBM.IsEqualPos( *pBkmk ));
+
+ SwCallLink aLk( *this );
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ FASTBOOL bRet = FALSE;
+ do {
+ pBkmk = rBkmks[ nPos ];
+
+ *pCrsr->GetPoint() = pBkmk->GetPos();
+ if( pBkmk->GetOtherPos() )
+ {
+ pCrsr->SetMark();
+ *pCrsr->GetMark() = *pBkmk->GetOtherPos();
+ if( *pCrsr->GetMark() < *pCrsr->GetPoint() )
+ pCrsr->Exchange();
+ }
+ if( !pCrsr->IsSelOvr( SELOVER_CHECKNODESSECTION | SELOVER_TOGGLE ) )
+ {
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ bRet = TRUE;
+ }
+
+ } while( !bRet && nPos-- );
+
+ if( !bRet )
+ {
+ pCrsr->DeleteMark();
+ pCrsr->RestoreSavePos();
+ }
+
+ return bRet;
+}
+
+
+
+USHORT SwCrsrShell::GetBookmarkCnt(BOOL bBkmrk) const
+{
+ return pDoc->GetBookmarkCnt(bBkmrk);
+}
+
+
+SwBookmark& SwCrsrShell::GetBookmark(USHORT nPos, BOOL bBkmrk)
+{
+ return pDoc->GetBookmark(nPos, bBkmrk);
+}
+
+
+void SwCrsrShell::DelBookmark(USHORT nPos)
+{
+ StartAction();
+ pDoc->DelBookmark(nPos);
+ EndAction();
+}
+
+
+void SwCrsrShell::DelBookmark( const String& rName )
+{
+ StartAction();
+ pDoc->DelBookmark( rName );
+ EndAction();
+}
+
+
+USHORT SwCrsrShell::FindBookmark( const String& rName )
+{
+ return pDoc->FindBookmark( rName );
+}
+
+
+ // erzeugt einen eindeutigen Namen. Der Name selbst muss vorgegeben
+ // werden, es wird dann bei gleichen Namen nur durchnumeriert.
+void SwCrsrShell::MakeUniqueBookmarkName( String& rName )
+{
+ pDoc->MakeUniqueBookmarkName( rName );
+}
+
+
+
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
new file mode 100644
index 000000000000..b7452ccc7411
--- /dev/null
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -0,0 +1,2831 @@
+/*************************************************************************
+ *
+ * $RCSfile: crsrsh.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _HINTIDS_HXX
+#include
+#endif
+
+#ifndef _SVDMODEL_HXX //autogen
+#include
+#endif
+
+#ifndef _DOC_HXX
+#include
+#endif
+#ifndef _ROOTFRM_HXX
+#include
+#endif
+#ifndef _PAGEFRM_HXX
+#include
+#endif
+#ifndef _CNTFRM_HXX
+#include
+#endif
+#ifndef _VIEWIMP_HXX
+#include
+#endif
+#ifndef _ERRHDL_HXX
+#include // fuer ASSERT
+#endif
+#ifndef _PAM_HXX
+#include
+#endif
+#ifndef _NDTXT_HXX
+#include
+#endif
+#ifndef _FLYFRM_HXX
+#include
+#endif
+#ifndef _DVIEW_HXX
+#include
+#endif
+#ifndef _VIEWOPT_HXX
+#include
+#endif
+#ifndef _FRMTOOL_HXX
+#include
+#endif
+#ifndef _CRSRSH_HXX
+#include
+#endif
+#ifndef _TABFRM_HXX
+#include
+#endif
+#ifndef _TXTFRM_HXX
+#include
+#endif
+#ifndef _SWTABLE_HXX
+#include
+#endif
+#ifndef _CALLNK_HXX
+#include
+#endif
+#ifndef _VISCRS_HXX
+#include
+#endif
+#ifndef _SECTION_HXX
+#include
+#endif
+#ifndef _DOCSH_HXX
+#include
+#endif
+#ifndef _SWGLOBDOCSH_HXX //autogen
+#include
+#endif
+#ifndef _PAMTYP_HXX
+#include
+#endif
+#ifndef _MDIEXP_HXX
+#include // ...Percent()
+#endif
+#ifndef _FMTEIRO_HXX //autogen
+#include
+#endif
+
+using namespace ::com::sun::star;
+
+TYPEINIT2(SwCrsrShell,ViewShell,SwModify);
+
+
+// Funktion loescht, alle ueberlappenden Cursor aus einem Cursor-Ring
+void CheckRange( SwCursor* );
+
+//-----------------------------------------------------------------------
+
+/*
+ * Ueberpruefe ob der pCurCrsr in einen schon bestehenden Bereich zeigt.
+ * Wenn ja, dann hebe den alten Bereich auf.
+ */
+
+
+void CheckRange( SwCursor* pCurCrsr )
+{
+ const SwPosition *pStt = pCurCrsr->Start(),
+ *pEnd = pCurCrsr->GetPoint() == pStt ? pCurCrsr->GetMark() : pCurCrsr->GetPoint();
+
+ SwPaM *pTmpDel = 0,
+ *pTmp = (SwPaM*)pCurCrsr->GetNext();
+
+ // durchsuche den gesamten Ring
+ while( pTmp != pCurCrsr )
+ {
+ const SwPosition *pTmpStt = pTmp->Start(),
+ *pTmpEnd = pTmp->GetPoint() == pTmpStt ?
+ pTmp->GetMark() : pTmp->GetPoint();
+ if( *pStt <= *pTmpStt )
+ {
+ if( *pEnd > *pTmpStt ||
+ ( *pEnd == *pTmpStt && *pEnd == *pTmpEnd ))
+ pTmpDel = pTmp;
+ }
+ else
+ if( *pStt < *pTmpEnd )
+ pTmpDel = pTmp;
+ /*
+ * liegt ein SPoint oder GetMark innerhalb vom Crsr-Bereich
+ * muss der alte Bereich aufgehoben werden.
+ * Beim Vergleich ist darauf zu achten, das SPoint nicht mehr zum
+ * Bereich gehoert !
+ */
+ pTmp = (SwPaM*)pTmp->GetNext();
+ if( pTmpDel )
+ {
+ delete pTmpDel; // hebe alten Bereich auf
+ pTmpDel = 0;
+ }
+ }
+}
+
+// -------------- Methoden von der SwCrsrShell -------------
+
+SwPaM * SwCrsrShell::CreateCrsr()
+{
+ // Innerhalb der Tabellen-SSelection keinen neuen Crsr anlegen
+ ASSERT( !IsTableMode(), "in Tabellen SSelection" );
+
+ // neuen Cursor als Kopie vom akt. und in den Ring aufnehmen
+ // Verkettung zeigt immer auf den zuerst erzeugten, also vorwaerts
+ SwShellCrsr* pNew = new SwShellCrsr( *pCurCrsr );
+
+ // hier den akt. Pam nur logisch Hiden, weil sonst die Invertierung
+ // vom kopierten Pam aufgehoben wird !!
+ pNew->Insert( pCurCrsr, 0 );
+ pCurCrsr->Remove( 0, pCurCrsr->Count() );
+
+ pCurCrsr->DeleteMark();
+
+ UpdateCrsr( SwCrsrShell::SCROLLWIN );
+// return pCurCrsr;
+ return pNew;
+}
+
+// loesche den aktuellen Cursor und der folgende wird zum Aktuellen
+
+
+FASTBOOL SwCrsrShell::DestroyCrsr()
+{
+ // Innerhalb der Tabellen-SSelection keinen neuen Crsr loeschen
+ ASSERT( !IsTableMode(), "in Tabellen SSelection" );
+
+ // ist ueberhaupt ein naechtser vorhanden ?
+ if(pCurCrsr->GetNext() == pCurCrsr)
+ return FALSE;
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCursor* pNext = (SwCursor*)pCurCrsr->GetNext();
+ delete pCurCrsr;
+ pCurCrsr = (SwShellCrsr*)*pNext;
+ UpdateCrsr();
+ return TRUE;
+}
+
+
+// gebe den aktuellen zurueck
+
+SwPaM* SwCrsrShell::GetCrsr( FASTBOOL bMakeTblCrsr ) const
+{
+ if( pTblCrsr )
+ {
+ if( bMakeTblCrsr && pTblCrsr->IsCrsrMovedUpdt() )
+ {
+ // geparkte Cursor werden nicht wieder erzeugt
+ const SwCntntNode* pCNd;
+ if( pTblCrsr->GetPoint()->nNode.GetIndex() &&
+ pTblCrsr->GetMark()->nNode.GetIndex() &&
+ 0 != ( pCNd = pTblCrsr->GetCntntNode() ) && pCNd->GetFrm() &&
+ 0 != ( pCNd = pTblCrsr->GetCntntNode(FALSE) ) && pCNd->GetFrm())
+ {
+ SwShellTableCrsr* pTC = (SwShellTableCrsr*)pTblCrsr;
+ GetLayout()->MakeTblCrsrs( *pTC );
+ }
+ }
+
+ if( pTblCrsr->IsChgd() )
+ {
+ SwCrsrShell* pThis = (SwCrsrShell*)this;
+ pThis->pCurCrsr = (SwShellCrsr*)
+ *pTblCrsr->MakeBoxSels( pThis->pCurCrsr );
+ }
+ }
+ return pCurCrsr;
+}
+
+
+void SwCrsrShell::StartAction()
+{
+ if( !ActionPend() )
+ {
+ // fuer das Update des Ribbon-Bars merken
+ const SwNode& rNd = pCurCrsr->GetPoint()->nNode.GetNode();
+ nAktNode = rNd.GetIndex();
+ nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
+ nAktNdTyp = rNd.GetNodeType();
+ if( ND_TEXTNODE & nAktNdTyp )
+ nLeftFrmPos = SwCallLink::GetFrm( (SwTxtNode&)rNd, nAktCntnt, TRUE );
+ else
+ nLeftFrmPos = 0;
+ }
+ ViewShell::StartAction(); // zur ViewShell
+}
+
+
+void SwCrsrShell::EndAction( const BOOL bIdleEnd )
+{
+/*
+//OS: Wird z.B. eine Basic-Action im Hintergrund ausgefuehrt, geht es so nicht
+ if( !bHasFocus )
+ {
+ // hat die Shell nicht den Focus, dann nur das EndAction an
+ // die ViewShell weitergeben.
+ ViewShell::EndAction( bIdleEnd );
+ return;
+ }
+*/
+
+ FASTBOOL bVis = bSVCrsrVis;
+
+ // Idle-Formatierung ?
+ if( bIdleEnd && Imp()->GetRegion() )
+ {
+ pCurCrsr->Hide();
+
+#ifdef SHOW_IDLE_REGION
+if( GetWin() )
+{
+ GetWin()->Push();
+ GetWin()->ChangePen( Pen( Color( COL_YELLOW )));
+ for( USHORT n = 0; n < aPntReg.Count(); ++n )
+ {
+ SwRect aIRect( aPntReg[n] );
+ GetWin()->DrawRect( aIRect.SVRect() );
+ }
+ GetWin()->Pop();
+}
+#endif
+
+ }
+
+ // vor der letzten Action alle invaliden Numerierungen updaten
+ if( 1 == nStartAction )
+ GetDoc()->UpdateNumRule();
+
+ // Task: 76923: dont show the cursor in the ViewShell::EndAction() - call.
+ // Only the UpdateCrsr shows the cursor.
+ BOOL bSavSVCrsrVis = bSVCrsrVis;
+ bSVCrsrVis = FALSE;
+
+ ViewShell::EndAction( bIdleEnd ); //der ViewShell den Vortritt lassen
+
+ bSVCrsrVis = bSavSVCrsrVis;
+
+ if( ActionPend() )
+ {
+ if( bVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+
+ // falls noch ein ChgCall vorhanden ist und nur noch die Basic
+ // Klammerung vorhanden ist, dann rufe ihn. Dadurch wird die interne
+ // mit der Basic-Klammerung entkoppelt; die Shells werden umgeschaltet
+ if( !BasicActionPend() )
+ {
+ //JP 12.01.98: Bug #46496# - es muss innerhalb einer BasicAction
+ // der Cursor geupdatet werden; um z.B. den
+ // TabellenCursor zu erzeugen. Im UpdateCrsr wird
+ // das jetzt beruecksichtigt!
+ UpdateCrsr( SwCrsrShell::CHKRANGE, bIdleEnd );
+
+ {
+ // Crsr-Moves ueberwachen, evt. Link callen
+ // der DTOR ist das interressante!!
+ SwCallLink aLk( *this, nAktNode, nAktCntnt, (BYTE)nAktNdTyp,
+ nLeftFrmPos );
+
+ }
+ if( bCallChgLnk && bChgCallFlag && aChgLnk.IsSet() )
+ {
+ aChgLnk.Call( this );
+ bChgCallFlag = FALSE; // Flag zuruecksetzen
+ }
+ }
+ return;
+ }
+
+ USHORT nParm = SwCrsrShell::CHKRANGE;
+ if ( !bIdleEnd )
+ nParm |= SwCrsrShell::SCROLLWIN;
+ UpdateCrsr( nParm, bIdleEnd ); // Cursor-Aenderungen anzeigen
+
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ aLk.nNode = nAktNode; // evt. Link callen
+ aLk.nNdTyp = (BYTE)nAktNdTyp;
+ aLk.nCntnt = nAktCntnt;
+ aLk.nLeftFrmPos = nLeftFrmPos;
+
+ if( !nCrsrMove ||
+ ( 1 == nCrsrMove && bInCMvVisportChgd ) )
+ ShowCrsrs( bSVCrsrVis ? TRUE : FALSE ); // Cursor & Selektionen wieder anzeigen
+ }
+ // falls noch ein ChgCall vorhanden ist, dann rufe ihn
+ if( bCallChgLnk && bChgCallFlag && aChgLnk.IsSet() )
+ {
+ aChgLnk.Call( this );
+ bChgCallFlag = FALSE; // Flag zuruecksetzen
+ }
+}
+
+
+#if !defined( PRODUCT )
+
+void SwCrsrShell::SttCrsrMove()
+{
+ ASSERT( nCrsrMove < USHRT_MAX, "To many nested CrsrMoves." );
+ ++nCrsrMove;
+ StartAction();
+}
+
+void SwCrsrShell::EndCrsrMove( const BOOL bIdleEnd )
+{
+ ASSERT( nCrsrMove, "EndCrsrMove() ohne SttCrsrMove()." );
+ EndAction( bIdleEnd );
+ if( !--nCrsrMove )
+ bInCMvVisportChgd = FALSE;
+}
+
+#endif
+
+
+FASTBOOL SwCrsrShell::LeftRight( BOOL bLeft, USHORT nCnt )
+{
+ if( IsTableMode() )
+ return bLeft ? GoPrevCell() : GoNextCell();
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ FASTBOOL bRet = pCurCrsr->LeftRight( bLeft, nCnt );
+ if( bRet )
+ UpdateCrsr();
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::UpDown( BOOL bUp, USHORT nCnt )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ BOOL bTableMode = IsTableMode();
+ SwShellCrsr* pTmpCrsr = bTableMode ? pTblCrsr : pCurCrsr;
+
+ FASTBOOL bRet = pTmpCrsr->UpDown( bUp, nCnt );
+ if( bRet )
+ {
+ eMvState = MV_UPDOWN; // Status fuers Crsr-Travelling - GetCrsrOfst
+ if( !ActionPend() )
+ {
+ CrsrFlag eUpdtMode = SwCrsrShell::SCROLLWIN;
+ if( !bTableMode )
+ eUpdtMode = (CrsrFlag) (eUpdtMode
+ | SwCrsrShell::UPDOWN | SwCrsrShell::CHKRANGE);
+ UpdateCrsr( eUpdtMode );
+ }
+ }
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::LRMargin( BOOL bLeft, BOOL bAPI)
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SET_CURR_SHELL( this );
+ eMvState = MV_LEFTMARGIN; // Status fuers Crsr-Travelling - GetCrsrOfst
+
+ BOOL bTableMode = IsTableMode();
+ SwShellCrsr* pTmpCrsr = bTableMode ? pTblCrsr : pCurCrsr;
+ FASTBOOL bRet = pTmpCrsr->LeftRightMargin( bLeft, bAPI );
+ if( bRet )
+ UpdateCrsr();
+ return bRet;
+}
+
+FASTBOOL SwCrsrShell::IsAtLRMargin( BOOL bLeft, BOOL bAPI ) const
+{
+ SwShellCrsr* pTmpCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ return pTmpCrsr->IsAtLeftRightMargin( bLeft, bAPI );
+}
+
+
+FASTBOOL SwCrsrShell::SttEndDoc( BOOL bStt )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ FASTBOOL bRet = pCurCrsr->SttEndDoc( bStt );
+ if( bRet )
+ {
+ if( bStt )
+ pCurCrsr->GetPtPos().Y() = 0; // expl. 0 setzen (TabellenHeader)
+
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+
+
+FASTBOOL SwCrsrShell::MovePage( SwWhichPage fnWhichPage, SwPosPage fnPosPage )
+{
+ FASTBOOL bRet = FALSE;
+
+ // Springe beim Selektieren nie ueber Section-Grenzen !!
+ if( !pCurCrsr->HasMark() || !pCurCrsr->IsNoCntnt() )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SET_CURR_SHELL( this );
+
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ Point& rPt = pCurCrsr->GetPtPos();
+ SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->
+ GetFrm( &rPt, pCurCrsr->GetPoint() );
+ if( pFrm && TRUE == ( bRet = GetFrmInPage( pFrm, fnWhichPage,
+ fnPosPage, pCurCrsr ) ) &&
+ !pCurCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ))
+ UpdateCrsr();
+ else
+ bRet = FALSE;
+ }
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ FASTBOOL bRet = pCurCrsr->MovePara( fnWhichPara, fnPosPara );
+ if( bRet )
+ UpdateCrsr();
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::MoveSection( SwWhichSection fnWhichSect,
+ SwPosSection fnPosSect)
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ FASTBOOL bRet = pCurCrsr->MoveSection( fnWhichSect, fnPosSect );
+ if( bRet )
+ UpdateCrsr();
+ return bRet;
+
+}
+
+
+// Positionieren des Cursors
+
+
+SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt )
+{
+ SwFrm* pFrm = 0;
+ SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode();
+ if( pCNd )
+ {
+ pFrm = pCNd->GetFrm( &rPt, 0, FALSE )->GetUpper();
+ while( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
+ pFrm = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->GetAnchor()
+ : pFrm->GetUpper();
+ }
+ return pFrm;
+}
+
+FASTBOOL SwCrsrShell::IsInHeaderFooter( FASTBOOL* pbInHeader ) const
+{
+ SwShellCrsr* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ Point aPt;
+ SwFrm* pFrm = ::lcl_IsInHeaderFooter( pCurCrsr->GetPoint()->nNode, aPt );
+ if( pFrm && pbInHeader )
+ *pbInHeader = pFrm->IsHeaderFrm();
+ return 0 != pFrm;
+}
+
+int SwCrsrShell::SetCrsr( const Point &rLPt, BOOL bOnlyText )
+{
+ SET_CURR_SHELL( this );
+
+ SwNodes& rNds = GetDoc()->GetNodes();
+ SwShellCrsr* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ SwPosition aPos( *pCrsr->GetPoint() );
+ Point aPt( rLPt );
+ Point & rAktCrsrPt = pCrsr->GetPtPos();
+ SwCrsrMoveState aTmpState( IsTableMode() ? MV_TBLSEL :
+ bOnlyText ? MV_SETONLYTEXT : MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+
+ int bRet = CRSR_POSOLD |
+ ( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState )
+ ? 0 : CRSR_POSCHG );
+
+ if( MV_RIGHTMARGIN == aTmpState.eState )
+ eMvState = MV_RIGHTMARGIN;
+ // steht neu Pos im Header/Footer ?
+ SwFrm* pFrm = lcl_IsInHeaderFooter( aPos.nNode, aPt );
+ if( IsTableMode() && !pFrm && aPos.nNode.GetNode().FindStartNode() ==
+ pCrsr->GetPoint()->nNode.GetNode().FindStartNode() )
+ // gleiche Tabellenzelle und nicht im Header/Footer
+ // -> zurueck
+ return bRet;
+
+ if( !pCrsr->HasMark() )
+ {
+ // steht an der gleichen Position und wenn im Header/Footer,
+ // dann im gleichen
+ if( aPos == *pCrsr->GetPoint() )
+ {
+ if( pFrm )
+ {
+ if( pFrm->Frm().IsInside( rAktCrsrPt ))
+ return bRet;
+ }
+ else if( aPos.nNode.GetNode().IsCntntNode() )
+ {
+ // im gleichen Frame gelandet?
+ SwFrm* pOld = ((SwCntntNode&)aPos.nNode.GetNode()).GetFrm(
+ &aCharRect.Pos(), 0, FALSE );
+ SwFrm* pNew = ((SwCntntNode&)aPos.nNode.GetNode()).GetFrm(
+ &aPt, 0, FALSE );
+ if( pNew == pOld )
+ return bRet;
+ }
+ }
+ }
+ else
+ {
+ // SSelection ueber nicht erlaubte Sections oder wenn im Header/Footer
+ // dann in verschiedene
+ if( !CheckNodesRange( aPos.nNode, pCrsr->GetMark()->nNode, TRUE )
+ || ( pFrm && !pFrm->Frm().IsInside( pCrsr->GetMkPos() ) ))
+ return bRet;
+
+ // steht an der gleichen Position und nicht im Header/Footer
+ if( aPos == *pCrsr->GetPoint() )
+ return bRet;
+ }
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ *pCrsr->GetPoint() = aPos;
+ rAktCrsrPt = aPt;
+
+ if( !pCrsr->IsSelOvr( SELOVER_CHANGEPOS ) )
+ {
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE);
+ bRet &= ~CRSR_POSOLD;
+ }
+ else if( bOnlyText && !pCurCrsr->HasMark() )
+ {
+ if( FindValidCntntNode( bOnlyText ) )
+ {
+ // Cursor in einen gueltigen Content stellen
+ if( aPos == *pCrsr->GetPoint() )
+ bRet = CRSR_POSOLD;
+ else
+ {
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE );
+ bRet &= ~CRSR_POSOLD;
+ }
+ }
+ else
+ {
+ // es gibt keinen gueltigen Inhalt -> Cursor verstecken
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling
+ bAllProtect = TRUE;
+ if( GetDoc()->GetDocShell() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( TRUE );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+void SwCrsrShell::TblCrsrToCursor()
+{
+ ASSERT( pTblCrsr, "TblCrsrToCursor: Why?" );
+ delete pTblCrsr, pTblCrsr = 0;
+}
+
+
+void SwCrsrShell::ClearMark()
+{
+ // ist ueberhaupt ein GetMark gesetzt ?
+ if( pTblCrsr )
+ {
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+ pTblCrsr->DeleteMark();
+
+ if( pCurCrsr->HasMark() )
+ {
+ // falls doch nicht alle Indizies richtig verschoben werden
+ // (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom
+ // Mark aufs Nodes-Array setzen
+ SwPosition& rPos = *pCurCrsr->GetMark();
+ rPos.nNode.Assign( pDoc->GetNodes(), 0 );
+ rPos.nContent.Assign( 0, 0 );
+ pCurCrsr->DeleteMark();
+ }
+
+ *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
+ delete pTblCrsr, pTblCrsr = 0;
+ pCurCrsr->SwSelPaintRects::Show();
+ }
+ else
+ {
+ if( !pCurCrsr->HasMark() )
+ return;
+ // falls doch nicht alle Indizies richtig verschoben werden
+ // (z.B.: Kopf-/Fusszeile loeschen) den Content-Anteil vom
+ // Mark aufs Nodes-Array setzen
+ SwPosition& rPos = *pCurCrsr->GetMark();
+ rPos.nNode.Assign( pDoc->GetNodes(), 0 );
+ rPos.nContent.Assign( 0, 0 );
+ pCurCrsr->DeleteMark();
+ if( !nCrsrMove )
+ pCurCrsr->SwSelPaintRects::Show();
+ }
+}
+
+
+void SwCrsrShell::SwapPam()
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr->Exchange();
+}
+
+
+// suche innerhalb der Selektierten-Bereiche nach einer Selektion, die
+// den angebenen SPoint umschliesst
+// Ist das Flag bTstOnly gesetzt, dann wird nur getestet, ob dort eine
+// SSelection besteht; des akt. Cursr wird nicht umgesetzt!
+// Ansonsten wird er auf die gewaehlte SSelection gesetzt.
+
+
+FASTBOOL SwCrsrShell::ChgCurrPam( const Point & rPt,
+ BOOL bTstOnly, BOOL bTstHit )
+{
+ SET_CURR_SHELL( this );
+
+ // Pruefe ob der SPoint in einer Tabellen-Selektion liegt
+ if( bTstOnly && pTblCrsr )
+ return pTblCrsr->IsInside( rPt );
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ // Suche die Position rPt im Dokument
+ SwPosition aPtPos( *pCurCrsr->GetPoint() );
+ Point aPt( rPt );
+
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ if ( !GetLayout()->GetCrsrOfst( &aPtPos, aPt, &aTmpState ) && bTstHit )
+ return FALSE;
+
+ // suche in allen Selektionen nach dieser Position
+ SwShellCrsr* pCmp = (SwShellCrsr*)pCurCrsr; // sicher den Pointer auf Cursor
+ do {
+ if( pCmp->HasMark() &&
+ *pCmp->Start() <= aPtPos && *pCmp->End() > aPtPos )
+ {
+ if( bTstOnly || pCurCrsr == pCmp ) // ist der aktuelle.
+ return TRUE; // return ohne Update
+
+ pCurCrsr = pCmp;
+ UpdateCrsr(); // Cursor steht schon richtig
+ return TRUE;
+ }
+ } while( pCurCrsr != ( pCmp = (SwShellCrsr*)*((SwCursor*)pCmp->GetNext()) ) );
+ return FALSE;
+}
+
+
+void SwCrsrShell::KillPams()
+{
+ // keiner zum loeschen vorhanden?
+ if( !pTblCrsr && pCurCrsr->GetNext() == pCurCrsr )
+ return;
+
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+
+ if( pTblCrsr )
+ {
+ // Cursor Ring loeschen
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
+ delete pTblCrsr, pTblCrsr = 0;
+ }
+ UpdateCrsr( SwCrsrShell::SCROLLWIN );
+}
+
+
+int SwCrsrShell::CompareCursor( CrsrCompareType eType ) const
+{
+ int nRet = 0;
+ const SwPosition *pFirst = 0, *pSecond = 0;
+ const SwPaM *pCur = GetCrsr(), *pStk = pCrsrStk;
+ if( CurrPtCurrMk != eType && pStk )
+ {
+ switch ( eType)
+ {
+ case StackPtStackMk:
+ pFirst = pStk->GetPoint();
+ pSecond = pStk->GetMark();
+ break;
+ case StackPtCurrPt:
+ pFirst = pStk->GetPoint();
+ pSecond = pCur->GetPoint();
+ break;
+ case StackPtCurrMk:
+ pFirst = pStk->GetPoint();
+ pSecond = pCur->GetMark();
+ break;
+ case StackMkCurrPt:
+ pFirst = pStk->GetMark();
+ pSecond = pCur->GetPoint();
+ break;
+ case StackMkCurrMk:
+ pFirst = pStk->GetMark();
+ pSecond = pStk->GetMark();
+ break;
+ case CurrPtCurrMk:
+ pFirst = pCur->GetPoint();
+ pSecond = pCur->GetMark();
+ break;
+ }
+ }
+ if( !pFirst || !pSecond )
+ nRet = INT_MAX;
+ else if( *pFirst < *pSecond )
+ nRet = -1;
+ else if( *pFirst == *pSecond )
+ nRet = 0;
+ else
+ nRet = 1;
+ return nRet;
+}
+
+
+FASTBOOL SwCrsrShell::IsSttPara() const
+{ return( pCurCrsr->GetPoint()->nContent == 0 ? TRUE : FALSE ); }
+
+
+FASTBOOL SwCrsrShell::IsEndPara() const
+{ return( pCurCrsr->GetPoint()->nContent == pCurCrsr->GetCntntNode()->Len() ? TRUE : FALSE ); }
+
+
+FASTBOOL SwCrsrShell::GotoPage( USHORT nPage )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ FASTBOOL bRet = GetLayout()->SetCurrPage( pCurCrsr, nPage ) &&
+ !pCurCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS );
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+void SwCrsrShell::GetPageNum( USHORT &rnPhyNum, USHORT &rnVirtNum,
+ BOOL bAtCrsrPos, const BOOL bCalcFrm )
+{
+ SET_CURR_SHELL( this );
+ // Seitennummer: die erste sichtbare Seite oder die am Cursor
+ const SwCntntFrm* pCFrm;
+ const SwPageFrm *pPg = 0;
+
+ if( !bAtCrsrPos || 0 == (pCFrm = GetCurrFrm( bCalcFrm )) ||
+ 0 == (pPg = pCFrm->FindPageFrm()) )
+ {
+ pPg = Imp()->GetFirstVisPage();
+ while( pPg && pPg->IsEmptyPage() )
+ pPg = (const SwPageFrm *)pPg->GetNext();
+ }
+ // Abfrage auf pPg muss fuer den Sonderfall Writerstart mit
+ // standard.vor sein.
+ rnPhyNum = pPg? pPg->GetPhyPageNum() : 1;
+ rnVirtNum = pPg? pPg->GetVirtPageNum() : 1;
+}
+
+
+USHORT SwCrsrShell::GetNextPrevPageNum( BOOL bNext )
+{
+ SET_CURR_SHELL( this );
+
+ // Seitennummer: die erste sichtbare Seite oder die am Cursor
+ const SwPageFrm *pPg = Imp()->GetFirstVisPage();
+ if( pPg )
+ {
+ if( bNext )
+ {
+ // erstmal die sichtbare suchen !!
+ while( pPg && pPg->IsEmptyPage() )
+ pPg = (const SwPageFrm *)pPg->GetNext();
+ while( pPg && 0 != (pPg = (const SwPageFrm *)pPg->GetNext() ) &&
+ pPg->IsEmptyPage() )
+ ;
+ }
+ else
+ {
+ while( pPg && 0 != (pPg = (const SwPageFrm *)pPg->GetPrev() ) &&
+ pPg->IsEmptyPage() )
+ ;
+ }
+ }
+ // Abfrage auf pPg muss fuer den Sonderfall Writerstart mit
+ // standard.vor sein.
+ return pPg ? pPg->GetPhyPageNum() : USHRT_MAX;
+}
+
+
+USHORT SwCrsrShell::GetPageCnt()
+{
+ SET_CURR_SHELL( this );
+ // gebe die Anzahl der Seiten zurueck
+ return GetLayout()->GetPageNum();
+}
+
+// Gehe zur naechsten SSelection
+
+
+FASTBOOL SwCrsrShell::GoNextCrsr()
+{
+ // besteht ueberhaupt ein Ring ?
+ if( pCurCrsr->GetNext() == pCurCrsr )
+ return FALSE;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr = (SwShellCrsr*)*((SwCursor*)pCurCrsr->GetNext());
+
+ // Bug 24086: auch alle anderen anzeigen
+ if( !ActionPend() )
+ {
+ UpdateCrsr();
+ pCurCrsr->Show();
+ }
+ return TRUE;
+}
+
+// gehe zur vorherigen SSelection
+
+
+FASTBOOL SwCrsrShell::GoPrevCrsr()
+{
+ // besteht ueberhaupt ein Ring ?
+ if( pCurCrsr->GetNext() == pCurCrsr )
+ return FALSE;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr = (SwShellCrsr*)*((SwCursor*)pCurCrsr->GetPrev());
+
+ // Bug 24086: auch alle anderen anzeigen
+ if( !ActionPend() )
+ {
+ UpdateCrsr();
+ pCurCrsr->Show();
+ }
+
+ return TRUE;
+}
+
+
+void SwCrsrShell::Paint( const Rectangle &rRect)
+{
+ SET_CURR_SHELL( this );
+
+ // beim Painten immer alle Cursor ausschalten
+ SwRect aRect( rRect );
+
+ FASTBOOL bVis = FALSE;
+ // ist Cursor sichtbar, dann verstecke den SV-Cursor
+ if( pVisCrsr->IsVisible() && !aRect.IsOver( aCharRect ) ) //JP 18.06.97: ???
+ {
+ bVis = TRUE;
+ pVisCrsr->Hide();
+ }
+
+ ViewShell::Paint( rRect ); // Bereich neu painten
+ if( bHasFocus && !bBasicHideCrsr )
+ {
+ SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+// pAktCrsr->Invalidate( aRect );
+ if( !ActionPend() )
+ {
+ // damit nicht rechts/unten die Raender abgeschnitten werden
+ pAktCrsr->Invalidate( VisArea() );
+ pAktCrsr->Show();
+ }
+ else
+ pAktCrsr->Invalidate( aRect );
+
+ }
+ if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+}
+
+
+
+void SwCrsrShell::VisPortChgd( const SwRect & rRect )
+{
+ SET_CURR_SHELL( this );
+ FASTBOOL bVis; // beim Scrollen immer alle Cursor ausschalten
+
+ // ist Cursor sichtbar, dann verstecke den SV-Cursor
+ if( TRUE == ( bVis = pVisCrsr->IsVisible() ))
+ pVisCrsr->Hide();
+
+ bVisPortChgd = TRUE;
+ aOldRBPos.X() = VisArea().Right();
+ aOldRBPos.Y() = VisArea().Bottom();
+
+ //Damit es es keine Probleme mit dem SV-Cursor gibt, wird in
+ //ViewShell::VisPo.. ein Update() auf das Window gerufen.
+ //Waehrend des Paintens duerfen aber nun wieder keine Selectionen
+ //angezeigt werden, deshalb wird der Aufruf hier geklammert.
+ ViewShell::VisPortChgd( rRect ); // Bereich verschieben
+
+/*
+ SwRect aRect( rRect );
+ if( VisArea().IsOver( aRect ) )
+ pCurCrsr->Invalidate( aRect );
+*/
+
+ if( bSVCrsrVis && bVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+
+ if( nCrsrMove )
+ bInCMvVisportChgd = TRUE;
+
+ bVisPortChgd = FALSE;
+}
+
+// aktualisiere den Crsrs, d.H. setze ihn wieder in den Content.
+// Das sollte nur aufgerufen werden, wenn der Cursor z.B. beim
+// Loeschen von Rahmen irgendwohin gesetzt wurde. Die Position
+// ergibt sich aus seiner aktuellen Position im Layout !!
+
+
+void SwCrsrShell::UpdateCrsrPos()
+{
+ SET_CURR_SHELL( this );
+ ++nStartAction;
+ Size aOldSz( GetLayout()->Frm().SSize() );
+ SwCntntNode *pCNode = pCurCrsr->GetCntntNode();
+ SwCntntFrm *pFrm = pCNode ?
+ pCNode->GetFrm( &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() ) :0;
+ if( !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) )
+ {
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ GetLayout()->GetCrsrOfst( pCurCrsr->GetPoint(), pCurCrsr->GetPtPos(),
+ &aTmpState );
+ if( pCurCrsr->HasMark())
+ pCurCrsr->DeleteMark();
+ }
+ --nStartAction;
+ if( aOldSz != GetLayout()->Frm().SSize() )
+ SizeChgNotify( GetLayout()->Frm().SSize() );
+}
+
+
+BOOL lcl_IsInValueBox( const SwPaM& rCrsr, SwCrsrShell& rShell )
+{
+ BOOL bRet = FALSE;
+ const SwStartNode* pSttNd = rCrsr.GetNode()->FindSttNodeByType( SwTableBoxStartNode );
+ if( pSttNd )
+ {
+ const SwFrmFmt* pFmt = pSttNd->FindTableNode()->GetTable().
+ GetTblBox( pSttNd->GetIndex() )->GetFrmFmt();
+ bRet = SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE ) ||
+ SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMULA );
+ // der WrtShell bescheid sagen!!!
+ rShell.NewCoreSelection();
+ }
+ return bRet;
+}
+
+// JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen
+// stehen, so mussen diese daraus verschoben werden
+void lcl_CheckHiddenSection( SwNodeIndex& rIdx )
+{
+ const SwSectionNode* pSectNd = rIdx.GetNode().FindSectionNode();
+ if( pSectNd && pSectNd->GetSection().IsHiddenFlag() )
+ {
+ SwNodeIndex aTmp( *pSectNd );
+ const SwNode* pFrmNd = rIdx.GetNodes().FindPrvNxtFrmNode(
+ aTmp, pSectNd->EndOfSectionNode() );
+ ASSERT( pFrmNd, "keinen Node mit Frames gefunden" );
+ rIdx = aTmp;
+ }
+}
+
+void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd )
+{
+ SET_CURR_SHELL( this );
+
+#ifdef DEBUG
+// pruefe ob die Indizies auch in den richtigen Nodes angemeldet sind
+{
+ SwShellCrsr* pCmp = (SwShellCrsr*)pCurCrsr; // sicher den Pointer auf Cursor
+ do {
+ ASSERT( pCmp->GetPoint()->nContent.GetIdxReg()
+ == pCmp->GetCntntNode(), "SPoint im falschen Node" );
+ ASSERT( pCmp->GetMark()->nContent.GetIdxReg()
+ == pCmp->GetCntntNode(FALSE), "Mark im falschen Node" );
+ FASTBOOL bTst = *pCmp->GetPoint() == *pCmp->GetMark();
+ } while( pCurCrsr != ( pCmp = (SwShellCrsr*)*((SwCursor*)pCmp->GetNext() ) ));
+}
+#endif
+
+ // erfrage den Count fuer die Start-/End-Actions und ob die Shell
+ // ueberhaupt den Focus hat
+// if( ActionPend() /*|| !bHasFocus*/ )
+ //JP 12.01.98: Bug #46496# - es muss innerhalb einer BasicAction der
+ // Cursor geupdatet werden; um z.B. den TabellenCursor zu
+ // erzeugen. Im EndAction wird jetzt das UpdateCrsr gerufen!
+ if( ActionPend() && BasicActionPend() )
+ {
+ if ( eFlags & SwCrsrShell::READONLY )
+ bIgnoreReadonly = TRUE;
+ return; // wenn nicht, dann kein Update !!
+ }
+
+ if ( bIgnoreReadonly )
+ {
+ bIgnoreReadonly = FALSE;
+ eFlags |= SwCrsrShell::READONLY;
+ }
+
+ if( eFlags & SwCrsrShell::CHKRANGE ) // alle Cursor-Bewegungen auf
+ CheckRange( pCurCrsr ); // ueberlappende Bereiche testen
+
+ if( !bIdleEnd )
+ CheckTblBoxCntnt();
+
+ // steht der akt. Crsr in einer Tabelle und in unterschiedlichen Boxen
+ // (oder ist noch TabellenMode), dann gilt der Tabellen Mode
+ SwPaM* pTstCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ if( ( pTstCrsr->HasMark() &&
+ pDoc->IsIdxInTbl( pTstCrsr->GetPoint()->nNode ) &&
+ ( pTblCrsr ||
+ pTstCrsr->GetNode( TRUE )->FindStartNode() !=
+ pTstCrsr->GetNode( FALSE )->FindStartNode() ))
+ /*|| ( !pTblCrsr && lcl_IsInValueBox( *pTstCrsr, *this ) )*/ )
+ {
+ SwShellCrsr* pITmpCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ Point aTmpPt( pITmpCrsr->GetPtPos() );
+ Point aTmpMk( pITmpCrsr->GetMkPos() );
+ SwPosition* pPos = pITmpCrsr->GetPoint();
+
+ // JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen
+ // stehen, so mussen diese daraus verschoben werden
+ ::lcl_CheckHiddenSection( pPos->nNode );
+ ::lcl_CheckHiddenSection( pITmpCrsr->GetMark()->nNode );
+
+ SwCntntFrm *pTblFrm = pPos->nNode.GetNode().GetCntntNode()->
+ GetFrm( &aTmpPt, pPos ),
+ *pMarkTblFrm;
+ ASSERT( pTblFrm, "Tabelle Crsr nicht im Content ??" );
+
+ SwTabFrm *pTab = pTblFrm->FindTabFrm(), *pMarkTab;
+
+ if( pTab && pTab->GetTable()->IsHeadlineRepeat() && (
+ ( pTab->IsFollow() &&
+ ((SwLayoutFrm*)pTab->Lower())->IsAnLower( pTblFrm )) ||
+ ( (pMarkTab = (pMarkTblFrm = pITmpCrsr->GetCntntNode( FALSE )
+ ->GetFrm( &aTmpMk, pITmpCrsr->GetMark() ))->FindTabFrm())->IsFollow() &&
+ ((SwLayoutFrm*)pMarkTab->Lower())->IsAnLower( pMarkTblFrm )) ))
+ {
+ // in wiederholten Tabellen-Kopfzeilen wollen wir keine
+ // Tabellen-Selektion !!
+ pTblFrm = 0;
+
+ SwPosSection fnPosSect = *pPos < *pITmpCrsr->GetMark()
+ ? fnSectionStart
+ : fnSectionEnd;
+
+ // dann nur innerhalb der Box selektieren
+ if( pTblCrsr )
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pTblCrsr->GetMark();
+ pCurCrsr->GetMkPos() = pTblCrsr->GetMkPos();
+ pTblCrsr->DeleteMark();
+ pTblCrsr->SwSelPaintRects::Hide();
+ }
+
+ *pCurCrsr->GetPoint() = *pCurCrsr->GetMark();
+ (*fnSectionCurr)( *pCurCrsr, fnPosSect );
+ }
+
+ // wir wollen wirklich eine Tabellen-Selektion
+ if( pTab && pTblFrm )
+ {
+ if( !pTblCrsr )
+ {
+ pTblCrsr = new SwShellTableCrsr( *this,
+ *pCurCrsr->GetMark(), pCurCrsr->GetMkPos(),
+ *pPos, aTmpPt );
+ pCurCrsr->DeleteMark();
+ pCurCrsr->SwSelPaintRects::Hide();
+
+ CheckTblBoxCntnt();
+ }
+
+ if( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ) )
+ {
+ Point aCentrPt( aCharRect.Center() );
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ pTblFrm->GetCrsrOfst( pTblCrsr->GetPoint(), aCentrPt, &aTmpState );
+ if ( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ) )
+ ASSERT( !this, "GetCharRect failed." );
+ }
+// ALIGNRECT( aCharRect );
+
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+ // Curosr in den sichtbaren Bereich scrollen
+ if( (eFlags & SwCrsrShell::SCROLLWIN) &&
+ (HasSelection() || eFlags & SwCrsrShell::READONLY ||
+ !IsCrsrReadonly()) )
+ {
+ SwFrm* pBoxFrm = pTblFrm;
+ while( pBoxFrm && !pBoxFrm->IsCellFrm() )
+ pBoxFrm = pBoxFrm->GetUpper();
+ if( pBoxFrm )
+ MakeVisible( pBoxFrm->Frm() );
+ else
+ MakeVisible( aCharRect );
+ }
+
+ // lasse vom Layout die Crsr in den Boxen erzeugen
+ if( pTblCrsr->IsCrsrMovedUpdt() )
+ GetLayout()->MakeTblCrsrs( *pTblCrsr );
+ if( bHasFocus && !bBasicHideCrsr )
+ pTblCrsr->Show();
+
+ // Cursor-Points auf die neuen Positionen setzen
+ pTblCrsr->GetPtPos().X() = aCharRect.Left();
+ pTblCrsr->GetPtPos().Y() = aCharRect.Top();
+
+ if( bSVCrsrVis )
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aCharRect.Height();
+ pVisCrsr->Show(); // wieder anzeigen
+ }
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
+ return;
+ }
+ }
+
+ if( pTblCrsr )
+ {
+ // Cursor Ring loeschen
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
+ delete pTblCrsr, pTblCrsr = 0;
+ }
+
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+
+ // sind wir vielleicht in einer geschuetzten/versteckten Section ?
+ {
+ BOOL bChgState = TRUE;
+ const SwSectionNode* pSectNd = pCurCrsr->GetNode()->FindSectionNode();
+ if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() ||
+ ( !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag() &&
+ ( !pDoc->GetDocShell() ||
+ !pDoc->GetDocShell()->IsReadOnly() || bAllProtect )) ) )
+ {
+ if( !FindValidCntntNode( !HasDrawView() ||
+ 0 == Imp()->GetDrawView()->GetMarkList().GetMarkCount()))
+ {
+ // alles ist geschuetzt / versteckt -> besonderer Mode
+ if( bAllProtect && !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag() )
+ bChgState = FALSE;
+ else
+ {
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling
+ bAllProtect = TRUE;
+ if( GetDoc()->GetDocShell() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( TRUE );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ return;
+ }
+ }
+ }
+ if( bChgState )
+ {
+ BOOL bWasAllProtect = bAllProtect;
+ bAllProtect = FALSE;
+ if( bWasAllProtect && GetDoc()->GetDocShell() &&
+ GetDoc()->GetDocShell()->IsReadOnlyUI() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( FALSE );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ }
+ }
+
+ UpdateCrsrPos();
+
+
+ SwRect aOld( aCharRect );
+ FASTBOOL bFirst = TRUE;
+ SwCntntFrm *pFrm;
+ int nLoopCnt = 100;
+
+ do {
+ BOOL bAgainst;
+ do {
+ bAgainst = FALSE;
+ pFrm = pCurCrsr->GetCntntNode()->GetFrm(
+ &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+ // ist der Frm nicht mehr vorhanden, dann muss das gesamte Layout
+ // erzeugt werden, weil ja mal hier einer vorhanden war !!
+ if ( !pFrm )
+ {
+ do
+ {
+ CalcLayout();
+ pFrm = pCurCrsr->GetCntntNode()->GetFrm(
+ &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+ } while( !pFrm );
+ }
+ else if ( Imp()->IsIdleAction() )
+ //Wir stellen sicher, dass anstaendig Formatiert wurde #42224#
+ pFrm->PrepareCrsr();
+
+ // im geschuetzten Fly? aber bei Rahmenselektion ignorieren
+ if( !IsReadOnlyAvailable() && pFrm->IsProtected() &&
+ ( !Imp()->GetDrawView() ||
+ !Imp()->GetDrawView()->GetMarkList().GetMarkCount() ) &&
+ (!pDoc->GetDocShell() ||
+ !pDoc->GetDocShell()->IsReadOnly() || bAllProtect ) )
+ {
+ // dann suche eine gueltige Position
+ BOOL bChgState = TRUE;
+ if( !FindValidCntntNode(!HasDrawView() ||
+ 0 == Imp()->GetDrawView()->GetMarkList().GetMarkCount()))
+ {
+ // alles ist geschuetzt / versteckt -> besonderer Mode
+ if( bAllProtect )
+ bChgState = FALSE;
+ else
+ {
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling
+ bAllProtect = TRUE;
+ if( GetDoc()->GetDocShell() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( TRUE );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ return;
+ }
+ }
+
+ if( bChgState )
+ {
+ BOOL bWasAllProtect = bAllProtect;
+ bAllProtect = FALSE;
+ if( bWasAllProtect && GetDoc()->GetDocShell() &&
+ GetDoc()->GetDocShell()->IsReadOnlyUI() )
+ {
+ GetDoc()->GetDocShell()->SetReadOnlyUI( FALSE );
+ CallChgLnk(); // UI bescheid sagen!
+ }
+ bAllProtect = FALSE;
+ bAgainst = TRUE; // nochmal den richigen Frm suchen
+ }
+ }
+ } while( bAgainst );
+
+ if( !( eFlags & SwCrsrShell::NOCALRECT ))
+ {
+ SwCrsrMoveState aTmpState( eMvState );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ aTmpState.bRealHeight = !pCurCrsr->HasMark();
+ if( !pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint(), &aTmpState ) )
+ {
+ Point& rPt = pCurCrsr->GetPtPos();
+ rPt = aCharRect.Center();
+ pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), rPt, &aTmpState );
+ if ( !pFrm->GetCharRect(aCharRect, *pCurCrsr->GetPoint(), &aTmpState) )
+ ASSERT( !this, "GetCharRect failed." );
+ }
+// ALIGNRECT( aCharRect );
+
+ if( aTmpState.bRealHeight )
+ aCrsrHeight = aTmpState.aRealHeight;
+ else
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aCharRect.Height();
+ }
+ }
+ else
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aCharRect.Height();
+ }
+
+ if( !bFirst && aOld == aCharRect )
+ break;
+
+ // falls das Layout meint, nach dem 100 durchlauf ist man immer noch
+ // im Fluss, sollte man die akt. Pos. als gegeben hinnehmen!
+ // siehe Bug: 29658
+ if( !--nLoopCnt )
+ {
+ ASSERT( !this, "Endlosschleife? CharRect != OldCharRect ");
+ break;
+ }
+ aOld = aCharRect;
+ bFirst = FALSE;
+
+ // Cursor-Points auf die neuen Positionen setzen
+ pCurCrsr->GetPtPos().X() = aCharRect.Left();
+ pCurCrsr->GetPtPos().Y() = aCharRect.Top();
+
+ if( !(eFlags & SwCrsrShell::UPDOWN )) // alte Pos. von Up/Down loeschen
+ {
+ pFrm->Calc();
+ nUpDownX = aCharRect.Left() - pFrm->Frm().Left();
+ }
+
+ // Curosr in den sichtbaren Bereich scrollen
+ if( bHasFocus && eFlags & SwCrsrShell::SCROLLWIN &&
+ (HasSelection() || eFlags & SwCrsrShell::READONLY ||
+ !IsCrsrReadonly()) )
+ {
+ //JP 30.04.99: damit das EndAction, beim evtuellen Scrollen, den
+ // SV-Crsr nicht wieder sichtbar macht, wird hier das Flag
+ // gesichert und zurueckgesetzt.
+ BOOL bSav = bSVCrsrVis; bSVCrsrVis = FALSE;
+ MakeSelVisible();
+ bSVCrsrVis = bSav;
+ }
+
+ } while( eFlags & SwCrsrShell::SCROLLWIN );
+
+ if( !bIdleEnd && bHasFocus && !bBasicHideCrsr )
+ pCurCrsr->SwSelPaintRects::Show();
+
+ //Ggf. gescrollten Bereicht korrigieren (Alignment).
+ //Nur wenn gescrollt wurde, und wenn keine Selektion existiert.
+ if( pFrm && Imp()->IsScrolled() &&
+ pCurCrsr->GetNext() == pCurCrsr && !pCurCrsr->HasMark() )
+ Imp()->RefreshScrolledArea( aCharRect );
+
+
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
+
+ if( bSVCrsrVis )
+ pVisCrsr->Show(); // wieder anzeigen
+}
+
+
+
+// erzeuge eine Kopie vom Cursor und speicher diese im Stack
+
+
+void SwCrsrShell::Push()
+{
+ pCrsrStk = new SwShellCrsr( *this, *pCurCrsr->GetPoint(),
+ pCurCrsr->GetPtPos(), pCrsrStk );
+
+ if( pCurCrsr->HasMark() )
+ {
+ pCrsrStk->SetMark();
+ *pCrsrStk->GetMark() = *pCurCrsr->GetMark();
+ }
+}
+
+/*
+ * Loescht einen Cursor (gesteuert durch bOldCrsr)
+ * - vom Stack oder ( bOldCrsr = TRUE )
+ * - den aktuellen und der auf dem Stack stehende wird zum aktuellen
+ *
+ * Return: es war auf dem Stack noch einer vorhanden
+ */
+
+
+FASTBOOL SwCrsrShell::Pop( BOOL bOldCrsr )
+{
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ // noch weitere vorhanden ?
+ if( 0 == pCrsrStk )
+ return FALSE;
+
+ SwShellCrsr *pTmp = 0, *pOldStk = pCrsrStk;
+
+ // der Nachfolger wird der Aktuelle
+ if( pCrsrStk->GetNext() != pCrsrStk )
+ pTmp = (SwShellCrsr*)*((SwCursor*)pCrsrStk->GetNext());
+
+ if( bOldCrsr ) // loesche vom Stack
+ delete pCrsrStk; //
+
+ pCrsrStk = pTmp; // neu zuweisen
+
+ if( !bOldCrsr )
+ {
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ // wurde die sichtbare SSelection nicht veraendert
+ if( pOldStk->GetPtPos() == pCurCrsr->GetPtPos() ||
+ pOldStk->GetPtPos() == pCurCrsr->GetMkPos() )
+ {
+ // "Selektions-Rechtecke" verschieben
+ pCurCrsr->Insert( pOldStk, 0 );
+ pOldStk->Remove( 0, pOldStk->Count() );
+ }
+
+ if( pOldStk->HasMark() )
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pOldStk->GetMark();
+ pCurCrsr->GetMkPos() = pOldStk->GetMkPos();
+ }
+ else
+ // keine Selection also alte aufheben und auf die alte Pos setzen
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = *pOldStk->GetPoint();
+ pCurCrsr->GetPtPos() = pOldStk->GetPtPos();
+ delete pOldStk;
+
+ if( !pCurCrsr->IsInProtectTable( TRUE ) &&
+ !pCurCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ) )
+ UpdateCrsr(); // akt. Cursor Updaten
+ }
+ return TRUE;
+}
+
+/*
+ * Verbinde zwei Cursor miteinander.
+ * Loesche vom Stack den obersten und setzen dessen GetMark im Aktuellen.
+ */
+
+
+void SwCrsrShell::Combine()
+{
+ // noch weitere vorhanden ?
+ if( 0 == pCrsrStk )
+ return;
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde
+ {
+ if( !CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, TRUE ))
+ ASSERT( !this, "StackCrsr & akt. Crsr nicht in gleicher Section." );
+
+ // kopiere das GetMark
+ if( !pCurCrsr->HasMark() )
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pCrsrStk->GetMark();
+ pCurCrsr->GetMkPos() = pCrsrStk->GetMkPos();
+ }
+
+ SwShellCrsr * pTmp = 0;
+ if( pCrsrStk->GetNext() != pCrsrStk )
+ pTmp = (SwShellCrsr*)*((SwCursor*)pCrsrStk->GetNext());
+ delete pCrsrStk;
+ pCrsrStk = pTmp;
+ if( !pCurCrsr->IsInProtectTable( TRUE ) &&
+ !pCurCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS ) )
+ UpdateCrsr(); // akt. Cursor Updaten
+}
+
+
+void SwCrsrShell::HideCrsrs()
+{
+ if( !bHasFocus || bBasicHideCrsr )
+ return;
+
+ // ist Cursor sichtbar, dann verstecke den SV-Cursor
+ if( pVisCrsr->IsVisible() )
+ {
+ SET_CURR_SHELL( this );
+ pVisCrsr->Hide();
+ }
+ // hebe die Invertierung der SSelection auf
+ SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ pAktCrsr->Hide();
+}
+
+
+
+void SwCrsrShell::ShowCrsrs( BOOL bCrsrVis )
+{
+ if( !bHasFocus || bAllProtect || bBasicHideCrsr )
+ return;
+
+ SET_CURR_SHELL( this );
+ SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+ pAktCrsr->Show();
+
+ if( bSVCrsrVis && bCrsrVis ) // auch SV-Cursor wieder anzeigen
+ pVisCrsr->Show();
+}
+
+// Methoden zum Anzeigen bzw. Verstecken des sichtbaren Text-Cursors
+
+
+void SwCrsrShell::ShowCrsr()
+{
+ if( !bBasicHideCrsr )
+ {
+ bSVCrsrVis = TRUE;
+ UpdateCrsr();
+ }
+}
+
+
+void SwCrsrShell::HideCrsr()
+{
+ if( !bBasicHideCrsr )
+ {
+ bSVCrsrVis = FALSE;
+ // evt. die sel. Bereiche aufheben !!
+ SET_CURR_SHELL( this );
+ pVisCrsr->Hide();
+ }
+}
+
+
+void SwCrsrShell::ShLooseFcs()
+{
+ if( !bBasicHideCrsr )
+ HideCrsrs();
+ bHasFocus = FALSE;
+}
+
+
+void SwCrsrShell::ShGetFcs( BOOL bUpdate )
+{
+ bHasFocus = TRUE;
+ if( !bBasicHideCrsr && VisArea().Width() )
+ {
+ UpdateCrsr( bUpdate ? SwCrsrShell::CHKRANGE|SwCrsrShell::SCROLLWIN
+ : SwCrsrShell::CHKRANGE );
+ ShowCrsrs( bSVCrsrVis ? TRUE : FALSE );
+ }
+}
+
+// gebe den aktuellen Frame, in dem der Cursor steht, zurueck
+
+#if 0
+
+//MA 03. Nov. 95: Die letzten Anwender habe ich gerade aus wrtsh1.cxx entfernt.
+// Weil's so kunstvoll aussieht lass ich die Funktion vorlauefig
+// hier.
+
+
+Rectangle SwCrsrShell::GetCurrFrmArea() const
+{
+ //Sitzt der Crsr ueberhaupt auf einem CntntNode?
+ SET_CURR_SHELL( (ViewShell*)this );
+ Rectangle aRet;
+ SwCntntNode *pNd = GetNode().GetCntntNode();
+ if ( pNd )
+ {
+ const USHORT* pST = &nStartAction;
+ ++(*((USHORT*)pST));
+ const Size aOldSz( GetLayout()->Frm().SSize() );
+ SwCntntFrm *pFrm = pNd->GetFrm(
+ &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+ aRet = pFrm->Frm().SVRect();
+ --(*((USHORT*)pST));
+ if( aOldSz != GetLayout()->Frm().SSize() )
+ ((SwCrsrShell*)this)->SizeChgNotify( GetLayout()->Frm().SSize() );
+ }
+ return aRet;
+}
+#endif
+
+
+SwCntntFrm *SwCrsrShell::GetCurrFrm( const BOOL bCalcFrm ) const
+{
+ SET_CURR_SHELL( (ViewShell*)this );
+ SwCntntFrm *pRet = 0;
+ SwCntntNode *pNd = pCurCrsr->GetCntntNode();
+ if ( pNd )
+ {
+ if ( bCalcFrm )
+ {
+ const USHORT* pST = &nStartAction;
+ ++(*((USHORT*)pST));
+ const Size aOldSz( GetLayout()->Frm().SSize() );
+ pRet = pNd->GetFrm( &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+ --(*((USHORT*)pST));
+ if( aOldSz != GetLayout()->Frm().SSize() )
+ ((SwCrsrShell*)this)->SizeChgNotify( GetLayout()->Frm().SSize() );
+ }
+ else
+ pRet = pNd->GetFrm( &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint(), FALSE);
+ }
+ return pRet;
+}
+
+
+// alle Attribut/Format-Aenderungen am akt. Node werden an den
+// Link weitergeleitet.
+
+
+void SwCrsrShell::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+{
+ USHORT nWhich = pOld ? pOld->Which()
+ : pNew ? pNew->Which()
+ : RES_MSG_BEGIN;
+ if( bCallChgLnk &&
+ ( nWhich < RES_MSG_BEGIN || nWhich >= RES_MSG_END ||
+ nWhich == RES_FMT_CHG || nWhich == RES_UPDATE_ATTR ||
+ nWhich == RES_ATTRSET_CHG ))
+ // die Messages werden nicht weitergemeldet
+ //MA 07. Apr. 94 fix(6681): RES_UPDATE_ATTR wird implizit vom
+ //SwTxtNode::Insert(SwTxtHint*, USHORT) abgesetzt; hier wird reagiert und
+ //vom Insert brauch nicht mehr die Keule RES_FMT_CHG versandt werden.
+ CallChgLnk();
+
+ if( aGrfArrivedLnk.IsSet() && RES_GRAPHIC_ARRIVED == nWhich )
+ aGrfArrivedLnk.Call( this );
+}
+
+
+// Abfrage, ob der aktuelle Cursor eine Selektion aufspannt,
+// also, ob GetMark gesetzt und SPoint und GetMark unterschiedlich sind.
+
+
+FASTBOOL SwCrsrShell::HasSelection()
+{
+ SwPaM* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ return( IsTableMode() || ( pCurCrsr->HasMark() &&
+ *pCurCrsr->GetPoint() != *pCrsr->GetMark())
+ ? TRUE : FALSE );
+}
+
+
+void SwCrsrShell::CallChgLnk()
+{
+ // innerhalb von Start-/End-Action kein Call, sondern nur merken,
+ // das sich etwas geaendert hat. Wird bei EndAction beachtet.
+ if( BasicActionPend() )
+ bChgCallFlag = TRUE; // das Change merken
+ else if( aChgLnk.IsSet() )
+ {
+ if( bCallChgLnk )
+ aChgLnk.Call( this );
+ bChgCallFlag = FALSE; // Flag zuruecksetzen
+ }
+}
+
+// returne den am akt.Cursor selektierten Text eines Nodes.
+
+
+String SwCrsrShell::GetSelTxt() const
+{
+ String aTxt;
+ if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
+ pCurCrsr->GetMark()->nNode.GetIndex() )
+ {
+ SwTxtNode* pTxtNd = pCurCrsr->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ {
+ xub_StrLen nStt = pCurCrsr->Start()->nContent.GetIndex();
+ aTxt = pTxtNd->GetExpandTxt( nStt,
+ pCurCrsr->End()->nContent.GetIndex() - nStt );
+ }
+ }
+ return aTxt;
+}
+
+// gebe nur den Text ab der akt. Cursor Position zurueck (bis zum NodeEnde)
+
+
+String SwCrsrShell::GetText() const
+{
+ String aTxt;
+ if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
+ pCurCrsr->GetMark()->nNode.GetIndex() )
+ {
+ SwTxtNode* pTxtNd = pCurCrsr->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ aTxt = pTxtNd->GetTxt().Copy(
+ pCurCrsr->GetPoint()->nContent.GetIndex() );
+ }
+ return aTxt;
+}
+
+// retrurne die Anzahl der selektierten Zeichen.
+// Falls keine Selektion vorliegt entscheided nType was selektiert wird
+// bIntrnlChar besagt ob interne Zeichen erhalten bleiben (TRUE) oder
+// ob sie expandiert werden (z.B Felder/...)
+ULONG SwCrsrShell::GetCharCount( USHORT nType, BOOL bIntrnlChrs ) const
+{
+ if( IsTableMode() )
+ GetCrsr();
+
+ BOOL bPop = FALSE;
+ if( !pCurCrsr->HasMark() && pCurCrsr->GetNext() == pCurCrsr )
+ {
+ // dann den Type auswerten, ansonsten ist ein Bereich vorhanden
+ bPop = TRUE;
+ SwCrsrShell* pThis = (SwCrsrShell*)this;
+ pThis->Push();
+ switch( nType )
+ {
+ case GETCHARCOUNT_PARA: // Absatz selektieren
+ {
+ SwCntntNode* pCNd = pCurCrsr->GetCntntNode();
+ if( pCNd )
+ {
+ pCurCrsr->SetMark();
+ pCurCrsr->GetMark()->nContent.Assign( pCNd, 0 );
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ }
+ }
+ break;
+
+ case GETCHARCOUNT_SECTION: // "Section" selektieren
+ {
+ pCurCrsr->SetMark();
+ GoStartSection( pCurCrsr->GetMark() );
+ GoEndSection( pCurCrsr->GetPoint() );
+ }
+ break;
+ }
+ }
+
+ USHORT nCrsrCnt = 0;
+ ULONG nCount = 0;
+ USHORT nLineOffset = /* Basic zaehlt CRLF als ein Zeichen
+ LINEEND_CRLF == GetSystemLineEnd() ? 2 : 1*/ 1;
+
+ const SwPaM* pTmp = pCurCrsr;
+ do {
+ ++nCrsrCnt;
+ const SwPosition *pStt = pTmp->Start(), *pEnd = pTmp->End();
+ if( *pStt < *pEnd )
+ {
+ ULONG nSttNd = pStt->nNode.GetIndex(),
+ nEndNd = pEnd->nNode.GetIndex();
+ xub_StrLen nSttCnt = pStt->nContent.GetIndex(),
+ nEndCnt = pEnd->nContent.GetIndex();
+
+ if( nSttNd != nEndNd )
+ {
+ for( ; nSttNd < nEndNd; ++nSttNd, nSttCnt = 0 )
+ {
+ const SwCntntNode* pCNd = pDoc->GetNodes()[
+ nSttNd ]->GetCntntNode();
+ if( pCNd )
+ {
+ if( pCNd->IsTxtNode() && !bIntrnlChrs )
+ nCount += ((SwTxtNode*)pCNd)->GetExpandTxt(
+ nSttCnt ).Len();
+ else
+ nCount += pCNd->Len();
+
+ nCount += nLineOffset;
+ }
+ }
+ }
+
+ if( bIntrnlChrs )
+ nCount += nEndCnt - nSttCnt;
+ else
+ {
+ const SwTxtNode* pNd = pDoc->GetNodes()[ nEndNd ]->GetTxtNode();
+ if( pNd )
+ nCount += pNd->GetExpandTxt( nSttCnt,
+ nEndCnt - nSttCnt ).Len();
+ }
+ }
+ } while( pCurCrsr != ( pTmp = (SwPaM*)pTmp->GetNext() ) );
+
+ // bei TabellenSelektion werden alle Boxen mit CR/LF abgeschlossen
+ if( IsTableMode() && 1 < nCrsrCnt )
+ nCount += nCrsrCnt * nLineOffset;
+
+ if( bPop )
+ {
+ SwCrsrShell* pThis = (SwCrsrShell*)this;
+ pThis->Pop( FALSE );
+ }
+
+ return nCount;
+}
+
+
+// hole vom Start/Ende der akt. SSelection das nte Zeichen
+sal_Unicode SwCrsrShell::GetChar( BOOL bEnd, long nOffset )
+{
+ if( IsTableMode() ) // im TabelleMode nicht moeglich
+ return 0;
+
+ const SwPosition* pPos = !pCurCrsr->HasMark() ? pCurCrsr->GetPoint()
+ : bEnd ? pCurCrsr->End() : pCurCrsr->Start();
+ SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNd, "kein TextNode, wie soll ein char returnt werden?" );
+
+ xub_StrLen nPos = pPos->nContent.GetIndex();
+ const String& rStr = pTxtNd->GetTxt();
+ sal_Unicode cCh = 0;
+
+ if( ((nPos+nOffset) >= 0 ) && (nPos+nOffset) < rStr.Len() )
+ cCh = rStr.GetChar( nPos+nOffset );
+
+ return cCh;
+}
+
+// erweiter die akt. SSelection am Anfang/Ende um n Zeichen
+
+
+FASTBOOL SwCrsrShell::ExtendSelection( BOOL bEnd, xub_StrLen nCount )
+{
+ if( !pCurCrsr->HasMark() || IsTableMode() )
+ return FALSE; // keine Selektion
+
+ SwPosition* pPos = bEnd ? pCurCrsr->End() : pCurCrsr->Start();
+ SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+ ASSERT( pTxtNd, "kein TextNode, wie soll erweitert werden?" );
+
+ xub_StrLen nPos = pPos->nContent.GetIndex();
+ if( bEnd )
+ {
+ if( ( nPos + nCount ) <= pTxtNd->GetTxt().Len() )
+ nPos += nCount;
+ else
+ return FALSE; // nicht mehr moeglich
+ }
+ else if( nPos >= nCount )
+ nPos -= nCount;
+ else
+ return FALSE; // nicht mehr moeglich
+
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+
+ pPos->nContent = nPos;
+ UpdateCrsr();
+
+ return TRUE;
+}
+
+// setze nur den sichtbaren Cursor an die angegebene Dokument-Pos.
+// returnt FALSE: wenn der SPoint vom Layout korrigiert wurde.
+
+FASTBOOL SwCrsrShell::SetVisCrsr( const Point &rPt )
+{
+ SET_CURR_SHELL( this );
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+ SwCrsrMoveState aTmpState( MV_SETONLYTEXT );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ aTmpState.bRealHeight = TRUE;
+
+ FASTBOOL bRet = GetLayout()->GetCrsrOfst( &aPos, aPt /*, &aTmpState*/ );
+ // nur in TextNodes anzeigen !!
+ SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode();
+ if( !pTxtNd )
+ return FALSE;
+
+ const SwSectionNode* pSectNd = pTxtNd->FindSectionNode();
+ if( pSectNd && (pSectNd->GetSection().IsHiddenFlag() ||
+ ( !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag())) )
+ return FALSE;
+
+ SwCntntFrm *pFrm = pTxtNd->GetFrm( &aPt, &aPos );
+ if ( Imp()->IsIdleAction() )
+ pFrm->PrepareCrsr();
+ SwRect aTmp( aCharRect );
+
+
+ pFrm->GetCharRect( aCharRect, aPos, &aTmpState );
+// ALIGNRECT( aCharRect );
+
+ if( aTmp == aCharRect && // BUG 10137: bleibt der Cursor auf der
+ pVisCrsr->IsVisible() ) // Position nicht hidden & showen
+ return TRUE;
+
+ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+ if( IsScrollMDI( this, aCharRect ))
+ {
+ MakeVisible( aCharRect );
+ pCurCrsr->Show();
+ }
+
+ // Bug 29584: bei Rahmenselektion ist der Cursor versteckt, aber den
+ // D&D-Cursor will man trotzdem haben
+// if( bSVCrsrVis )
+ {
+ if( aTmpState.bRealHeight )
+ aCrsrHeight = aTmpState.aRealHeight;
+ else
+ {
+ aCrsrHeight.X() = 0;
+ aCrsrHeight.Y() = aCharRect.Height();
+ }
+
+ pVisCrsr->SetDragCrsr( TRUE );
+ pVisCrsr->Show(); // wieder anzeigen
+ }
+ return bRet;
+}
+
+FASTBOOL SwCrsrShell::IsOverReadOnlyPos( const Point& rPt ) const
+{
+// SET_CURR_SHELL( this );
+ Point aPt( rPt );
+ SwPaM aPam( *pCurCrsr->GetPoint() );
+ FASTBOOL bRet = GetLayout()->GetCrsrOfst( aPam.GetPoint(), aPt );
+ return aPam.HasReadonlySel();
+}
+
+
+ // returne die Anzahl der Cursor im Ring (Flag besagt ob man nur
+ // aufgepspannte haben will - sprich etwas selektiert ist (Basic))
+USHORT SwCrsrShell::GetCrsrCnt( BOOL bAll ) const
+{
+ Ring* pTmp = GetCrsr()->GetNext();
+ USHORT n = (bAll || ( pCurCrsr->HasMark() &&
+ *pCurCrsr->GetPoint() != *pCurCrsr->GetMark())) ? 1 : 0;
+ while( pTmp != pCurCrsr )
+ {
+ if( bAll || ( ((SwPaM*)pTmp)->HasMark() &&
+ *((SwPaM*)pTmp)->GetPoint() != *((SwPaM*)pTmp)->GetMark()))
+ ++n;
+ pTmp = pTmp->GetNext();
+ }
+ return n;
+}
+
+
+FASTBOOL SwCrsrShell::IsStartOfDoc() const
+{
+ if( pCurCrsr->GetPoint()->nContent.GetIndex() )
+ return FALSE;
+
+ // Hinter EndOfIcons kommt die Content-Section (EndNd+StNd+CntntNd)
+ SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfExtras(), 2 );
+ if( !aIdx.GetNode().IsCntntNode() )
+ GetDoc()->GetNodes().GoNext( &aIdx );
+ return aIdx == pCurCrsr->GetPoint()->nNode;
+}
+
+
+FASTBOOL SwCrsrShell::IsEndOfDoc() const
+{
+ SwNodeIndex aIdx( GetDoc()->GetNodes().GetEndOfContent(), -1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoPrevious( &aIdx );
+
+ return aIdx == pCurCrsr->GetPoint()->nNode &&
+ pCNd->Len() == pCurCrsr->GetPoint()->nContent.GetIndex();
+}
+
+
+// loesche alle erzeugten Crsr, setze den Tabellen-Crsr und den letzten
+// Cursor auf seinen TextNode (oder StartNode?).
+// Beim naechsten ::GetCrsr werden sie wieder alle erzeugt
+// Wird fuers Drag&Drop / ClipBorad-Paste in Tabellen benoetigt.
+FASTBOOL SwCrsrShell::ParkTblCrsr()
+{
+ if( !pTblCrsr )
+ return FALSE;
+
+ pTblCrsr->ParkCrsr();
+
+ while( pCurCrsr->GetNext() != pCurCrsr )
+ delete pCurCrsr->GetNext();
+
+ // vom Cursor !immer! SPoint und Mark umsetzen
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+ pCurCrsr->DeleteMark();
+
+ return TRUE;
+}
+
+/***********************************************************************
+#* Class : SwCrsrShell
+#* Methode : ParkCrsr
+#* Beschreibung: Vernichtet Selektionen und zus. Crsr aller Shell der
+#* verbleibende Crsr der Shell wird geparkt.
+#* Datum : MA 05. Nov. 92
+#* Update : JP 19.09.97
+#***********************************************************************/
+
+void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing )
+{
+ const SwPosition *pStt = pDelRg->Start(),
+ *pEnd = pDelRg->GetPoint() == pStt ? pDelRg->GetMark() : pDelRg->GetPoint();
+
+ SwPaM *pTmpDel = 0, *pTmp = *ppDelRing;
+
+ // durchsuche den gesamten Ring
+ BOOL bGoNext;
+ do {
+ const SwPosition *pTmpStt = pTmp->Start(),
+ *pTmpEnd = pTmp->GetPoint() == pTmpStt ?
+ pTmp->GetMark() : pTmp->GetPoint();
+ /*
+ * liegt ein SPoint oder GetMark innerhalb vom Crsr-Bereich
+ * muss der alte Bereich aufgehoben werden.
+ * Beim Vergleich ist darauf zu achten, das End() nicht mehr zum
+ * Bereich gehoert !
+ */
+ if( *pStt <= *pTmpStt )
+ {
+ if( *pEnd > *pTmpStt ||
+ ( *pEnd == *pTmpStt && *pEnd == *pTmpEnd ))
+ pTmpDel = pTmp;
+ }
+ else
+ if( *pStt < *pTmpEnd )
+ pTmpDel = pTmp;
+
+ bGoNext = TRUE;
+ if( pTmpDel ) // ist der Pam im Bereich ?? loesche ihn
+ {
+ BOOL bDelete = TRUE;
+ if( *ppDelRing == pTmpDel )
+ {
+ if( *ppDelRing == pCurCrsr )
+ {
+ if( TRUE == ( bDelete = GoNextCrsr() ))
+ {
+ bGoNext = FALSE;
+ pTmp = (SwPaM*)pTmp->GetNext();
+ }
+ }
+ else
+ bDelete = FALSE; // StackCrsr nie loeschen !!
+ }
+
+ if( bDelete )
+ delete pTmpDel; // hebe alten Bereich auf
+ else
+ {
+ pTmpDel->GetPoint()->nContent.Assign( 0, 0 );
+ pTmpDel->GetPoint()->nNode = 0;
+ pTmpDel->SetMark();
+ pTmpDel->DeleteMark();
+ }
+ pTmpDel = 0;
+ }
+ else if( !pTmp->HasMark() ) // sorge auf jedenfall dafuer, das
+ { // nicht benutzte Indizies beachtet werden!
+ pTmp->SetMark(); // SPoint liegt nicht im Bereich,
+ pTmp->DeleteMark(); // aber vielleicht GetMark, also setzen
+ }
+ if( bGoNext )
+ pTmp = (SwPaM*)pTmp->GetNext();
+ } while( !bGoNext || *ppDelRing != pTmp );
+}
+
+void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx )
+{
+ SwNode *pNode = &rIdx.GetNode();
+
+ // erzeuge einen neuen Pam
+ SwPaM * pNew = new SwPaM( *GetCrsr()->GetPoint() );
+ if( pNode->GetStartNode() )
+ {
+ if( ( pNode = pNode->StartOfSectionNode())->IsTableNode() )
+ {
+ // der angegebene Node steht in einer Tabelle, also Parke
+ // den Crsr auf dem Tabellen-Node (ausserhalb der Tabelle)
+ pNew->GetPoint()->nNode = *pNode->StartOfSectionNode();
+ }
+ else // also auf dem StartNode selbst.
+ // Dann immer ueber seinen EndNode den StartNode erfragen !!!
+ // (StartOfSection vom StartNode ist der Parent !)
+ pNew->GetPoint()->nNode = *pNode->EndOfSectionNode()->StartOfSectionNode();
+ }
+ else
+ pNew->GetPoint()->nNode = *pNode->StartOfSectionNode();
+ pNew->SetMark();
+ pNew->GetPoint()->nNode = *pNode->EndOfSectionNode();
+
+ //Alle Shells wollen etwas davon haben.
+ ViewShell *pTmp = this;
+ do {
+ if( pTmp->IsA( TYPE( SwCrsrShell )))
+ {
+ SwCrsrShell* pSh = (SwCrsrShell*)pTmp;
+ if( pSh->pCrsrStk )
+ pSh->_ParkPams( pNew, &pSh->pCrsrStk );
+
+ pSh->_ParkPams( pNew, &pSh->pCurCrsr );
+ if( pSh->pTblCrsr )
+ {
+ // setze den Tabellen Cursor immer auf 0, den aktuellen
+ // immer auf den Anfang der Tabelle
+ SwPaM* pTCrsr = pSh->GetTblCrs();
+ SwNode* pTblNd = pTCrsr->GetPoint()->nNode.GetNode().FindTableNode();
+ if ( pTblNd )
+ {
+ pTCrsr->GetPoint()->nContent.Assign( 0, 0 );
+ pTCrsr->GetPoint()->nNode = 0;
+ pTCrsr->SetMark();
+ pTCrsr->DeleteMark();
+ pSh->pCurCrsr->GetPoint()->nNode = *pTblNd;
+ }
+ }
+ }
+ } while ( this != (pTmp = (ViewShell*)pTmp->GetNext() ));
+ delete pNew;
+}
+
+//=========================================================================
+
+/*
+ * der Copy-Constructor
+ * Cursor-Position kopieren, in den Ring eingetragen.
+ * Alle Ansichten eines Dokumentes stehen im Ring der Shells.
+ */
+
+SwCrsrShell::SwCrsrShell( SwCrsrShell * pShell, Window *pWin )
+ : ViewShell( pShell, pWin ),
+ SwModify( 0 )
+{
+ SET_CURR_SHELL( this );
+ // Nur die Position vom aktuellen Cursor aus der Copy-Shell uebernehmen
+ pCurCrsr = new SwShellCrsr( *this, *(pShell->pCurCrsr->GetPoint()) );
+ pCurCrsr->GetCntntNode()->Add( this );
+ pCrsrStk = 0;
+ pTblCrsr = 0;
+
+ nBasicActionCnt = 0;
+
+ pBoxIdx = 0;
+ pBoxPtr = 0;
+
+ /*
+ * setze die initiale Spalten-Position fuer Up / Down
+ */
+ nCrsrMove = 0;
+ bAllProtect = bVisPortChgd = bChgCallFlag = bInCMvVisportChgd =
+ bGCAttr = bIgnoreReadonly = bSelTblCells = bBasicHideCrsr = FALSE;
+ bCallChgLnk = bHasFocus = bSVCrsrVis = bAutoUpdateCells = TRUE;
+ bSetCrsrInReadOnly = TRUE;
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
+ pVisCrsr = new SwVisCrsr( this );
+// UpdateCrsr( 0 );
+}
+
+
+/*
+ * der normale Constructor
+ */
+
+SwCrsrShell::SwCrsrShell( SwDoc *pDoc,
+ uno::Reference< linguistic::XSpellChecker1> xSpell,
+ uno::Reference< linguistic::XHyphenator> xHyph,
+ Window *pWin, SwRootFrm *pRoot, const SwViewOption *pOpt )
+ : ViewShell( pDoc, xSpell, xHyph, pWin, pOpt ),
+ SwModify( 0 )
+{
+ SET_CURR_SHELL( this );
+ /*
+ * Erzeugen des initialen Cursors, wird auf die erste
+ * Inhaltsposition gesetzt
+ */
+ SwNodes& rNds = pDoc->GetNodes();
+
+ SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() );
+ SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode
+
+ pCurCrsr = new SwShellCrsr( *this, SwPosition( aNodeIdx, SwIndex( pCNd, 0 )));
+ pCrsrStk = 0;
+ pTblCrsr = 0;
+
+ nBasicActionCnt = 0;
+
+ pBoxIdx = 0;
+ pBoxPtr = 0;
+
+ // melde die Shell beim akt. Node als abhaengig an, dadurch koennen alle
+ // Attribut-Aenderungen ueber den Link weiter gemeldet werden.
+ pCNd->Add( this );
+
+ /*
+ * setze die initiale Spalten-Position fuer Up / Down
+ */
+ nCrsrMove = 0;
+ bAllProtect = bVisPortChgd = bChgCallFlag = bInCMvVisportChgd =
+ bGCAttr = bIgnoreReadonly = bSelTblCells = bBasicHideCrsr = FALSE;
+ bCallChgLnk = bHasFocus = bSVCrsrVis = bAutoUpdateCells = TRUE;
+ bSetCrsrInReadOnly = TRUE;
+ eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
+
+ pVisCrsr = new SwVisCrsr( this );
+// UpdateCrsr( 0 );
+}
+
+
+
+SwCrsrShell::~SwCrsrShell()
+{
+ // wenn es nicht die letzte View so sollte zu mindest das
+ // Feld noch geupdatet werden.
+ if( GetNext() != this )
+ CheckTblBoxCntnt( pCurCrsr->GetPoint() );
+ else
+ ClearTblBoxCntnt();
+
+ delete pVisCrsr;
+ delete pTblCrsr;
+
+ /*
+ * Freigabe der Cursor
+ */
+ while(pCurCrsr->GetNext() != pCurCrsr)
+ delete pCurCrsr->GetNext();
+ delete pCurCrsr;
+
+ // Stack freigeben
+ if( pCrsrStk )
+ {
+ while( pCrsrStk->GetNext() != pCrsrStk )
+ delete pCrsrStk->GetNext();
+ delete pCrsrStk;
+ }
+
+ // JP 27.07.98: Bug 54025 - ggfs. den HTML-Parser, der als Client in
+ // der CursorShell haengt keine Chance geben, sich an den
+ // TextNode zu haengen.
+ if( GetRegisteredIn() )
+ pRegisteredIn->Remove( this );
+}
+
+
+
+//Sollte fuer das Clipboard der WaitPtr geschaltet werden?
+//Warten bei TableMode, Mehrfachselektion und mehr als x Selektieren Absaetzen.
+
+FASTBOOL SwCrsrShell::ShouldWait() const
+{
+ if ( IsTableMode() || GetCrsrCnt() > 1 )
+ return TRUE;
+
+ if( HasDrawView() && GetDrawView()->GetMarkList().GetMarkCount() )
+ return TRUE;
+
+ SwPaM* pPam = GetCrsr();
+ return pPam->Start()->nNode.GetIndex() + 10 <
+ pPam->End()->nNode.GetIndex();
+}
+
+
+USHORT SwCrsrShell::UpdateTblSelBoxes()
+{
+ if( pTblCrsr && ( pTblCrsr->IsChgd() || !pTblCrsr->GetBoxesCount() ))
+ GetLayout()->MakeTblCrsrs( *pTblCrsr );
+ return pTblCrsr ? pTblCrsr->GetBoxesCount() : 0;
+}
+
+
+// steht der Curor auf einem "Symbol"-Zeichen
+FASTBOOL SwCrsrShell::IsInSymbolFont() const
+{
+ if( IsTableMode() )
+ return FALSE;
+
+ SwPosition* pPos = GetCrsr()->GetPoint();
+ SwTxtNode* pTNd = pPos->nNode.GetNode().GetTxtNode();
+ if( pTNd )
+ return pTNd->IsInSymbolFont( pPos->nContent.GetIndex() );
+ return FALSE;
+}
+
+
+// zeige das akt. selektierte "Object" an
+void SwCrsrShell::MakeSelVisible()
+{
+ ASSERT( bHasFocus, "kein Focus aber Cursor sichtbar machen?" );
+ if( aCrsrHeight.Y() < aCharRect.Height() && aCharRect.Height() > VisArea().Height() )
+ {
+ SwRect aTmp( aCharRect );
+ long nDiff = aCharRect.Height() - VisArea().Height();
+ if( nDiff < aCrsrHeight.X() )
+ aTmp.Top( nDiff + aCharRect.Top() );
+ else
+ {
+ aTmp.Top( aCrsrHeight.X() + aCharRect.Top() );
+ aTmp.Height( aCrsrHeight.Y() );
+ }
+ MakeVisible( aTmp );
+ }
+ else
+ {
+ if( aCharRect.HasArea() )
+ MakeVisible( aCharRect );
+ else
+ {
+ SwRect aTmp( aCharRect );
+ aTmp.SSize().Height() += 1; aTmp.SSize().Width() += 1;
+ MakeVisible( aTmp );
+ }
+ }
+}
+
+
+// suche eine gueltige ContentPosition (nicht geschuetzt/nicht versteckt)
+FASTBOOL SwCrsrShell::FindValidCntntNode( BOOL bOnlyText )
+{
+ if( pTblCrsr ) // was soll ich jetzt machen ??
+ {
+ ASSERT( !this, "TabellenSelection nicht aufgehoben!" );
+ return FALSE;
+ }
+
+ //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
+ if( !bAllProtect && GetDoc()->GetDocShell() &&
+ GetDoc()->GetDocShell()->IsReadOnlyUI() )
+ return TRUE;
+
+ // dann raus da!
+ if( pCurCrsr->HasMark() )
+ ClearMark();
+
+ // als erstes mal auf Rahmen abpruefen
+ SwNodeIndex& rNdIdx = pCurCrsr->GetPoint()->nNode;
+ ULONG nNdIdx = rNdIdx.GetIndex(); // sichern
+ SwNodes& rNds = pDoc->GetNodes();
+ SwCntntNode* pCNd = rNdIdx.GetNode().GetCntntNode();
+ const SwCntntFrm * pFrm;
+
+ if( pCNd && 0 != (pFrm = pCNd->GetFrm(0,pCurCrsr->GetPoint(),FALSE)) &&
+ !IsReadOnlyAvailable() && pFrm->IsProtected() &&
+ nNdIdx < rNds.GetEndOfExtras().GetIndex() )
+ {
+ // geschuetzter Rahmen ueberspringen
+ SwPaM aPam( *pCurCrsr->GetPoint() );
+ aPam.SetMark();
+ aPam.GetMark()->nNode = rNds.GetEndOfContent();
+ aPam.GetPoint()->nNode = *pCNd->EndOfSectionNode();
+
+ FASTBOOL bFirst = FALSE;
+ if( 0 == (pCNd = ::GetNode( aPam, bFirst, fnMoveForward, FALSE )))
+ {
+ aPam.GetMark()->nNode = *rNds.GetEndOfPostIts().StartOfSectionNode();
+ pCNd = ::GetNode( aPam, bFirst, fnMoveBackward, FALSE );
+ }
+
+ if( !pCNd ) // sollte nie passieren !!!
+ {
+ rNdIdx = nNdIdx; // alten Node zurueck
+ return FALSE;
+ }
+ *pCurCrsr->GetPoint() = *aPam.GetPoint();
+ }
+ else if( bOnlyText && pCNd && pCNd->IsNoTxtNode() )
+ {
+ // dann auf den Anfang vom Doc stellen
+ rNdIdx = pDoc->GetNodes().GetEndOfExtras();
+ pCurCrsr->GetPoint()->nContent.Assign( pDoc->GetNodes().GoNext(
+ &rNdIdx ), 0 );
+ nNdIdx = rNdIdx.GetIndex();
+ }
+
+ BOOL bOk = TRUE;
+
+ // was ist mit Tabelle?
+
+ // in einem geschuetzten Bereich
+ const SwSectionNode* pSectNd = rNdIdx.GetNode().FindSectionNode();
+ if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() ||
+ ( !IsReadOnlyAvailable() &&
+ pSectNd->GetSection().IsProtectFlag() )) )
+ {
+ typedef SwCntntNode* (SwNodes:: *FNGoSection)( SwNodeIndex *, int, int ) const;
+ FNGoSection fnGoSection = &SwNodes::GoNextSection;
+
+ bOk = FALSE;
+
+ for( int nLoopCnt = 0; !bOk && nLoopCnt < 2; ++nLoopCnt )
+ {
+ BOOL bWeiter;
+ do {
+ bWeiter = FALSE;
+ while( 0 != ( pCNd = (rNds.*fnGoSection)( &rNdIdx,
+ TRUE, !IsReadOnlyAvailable() )) )
+ {
+ // in eine Tabelle verschoben -> pruefe ob die
+ // vielleicht geschuetzt ist
+ if( pCNd->FindTableNode() )
+ {
+ SwCallLink aTmp( *this );
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ aTmp.nNdTyp = 0; // im DTOR nichts machen!
+ if( !pCurCrsr->IsInProtectTable( TRUE, TRUE ) )
+ {
+ const SwSectionNode* pSNd = pCNd->FindSectionNode();
+ if( !pSNd || !pSNd->GetSection().IsHiddenFlag()
+ || (!IsReadOnlyAvailable() &&
+ pSNd->GetSection().IsProtectFlag() ))
+ {
+ bOk = TRUE;
+ break; // eine nicht geschuetzte Zelle gef.
+ }
+ continue; // dann weiter suchen
+ }
+ }
+ else
+ {
+ bOk = TRUE;
+ break; // eine nicht geschuetzte Zelle gef.
+ }
+ }
+
+ if( bOk && rNdIdx.GetIndex() < rNds.GetEndOfExtras().GetIndex() )
+ {
+ // Teste mal auf Fly - kann auch noch geschuetzt sein!!
+ if( 0 == (pFrm = pCNd->GetFrm(0,0,FALSE)) ||
+ ( !IsReadOnlyAvailable() && pFrm->IsProtected() ) ||
+ ( bOnlyText && pCNd->IsNoTxtNode() ) )
+ {
+ // dann weiter suchen!
+ bOk = FALSE;
+ bWeiter = TRUE;
+ }
+ }
+ } while( bWeiter );
+
+ if( !bOk )
+ {
+ if( !nLoopCnt )
+ fnGoSection = &SwNodes::GoPrevSection;
+ rNdIdx = nNdIdx;
+ }
+ }
+ }
+ if( bOk )
+ {
+ pCNd = rNdIdx.GetNode().GetCntntNode();
+// USHORT nCntnt = Min( pCNd->Len(), pCurCrsr->GetPoint()->nContent.GetIndex() );
+ xub_StrLen nCntnt = rNdIdx.GetIndex() < nNdIdx ? pCNd->Len() : 0;
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, nCntnt );
+ }
+ else
+ {
+ pCNd = rNdIdx.GetNode().GetCntntNode();
+
+ // falls Cursor im versteckten Bereich ist, auf jedenfall schon mal
+ // verschieben!!
+ if( !pCNd || !pCNd->GetFrm(0,0,FALSE) )
+ {
+ SwCrsrMoveState aTmpState( MV_NONE );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+ GetLayout()->GetCrsrOfst( pCurCrsr->GetPoint(), pCurCrsr->GetPtPos(),
+ &aTmpState );
+ }
+ }
+ return bOk;
+}
+
+
+void SwCrsrShell::NewCoreSelection()
+{
+}
+
+
+FASTBOOL SwCrsrShell::IsCrsrReadonly() const
+{
+ if ( GetViewOptions()->IsReadonly() )
+ {
+ SwFrm *pFrm = GetCurrFrm( FALSE );
+ SwFlyFrm *pFly;
+ if( pFrm && pFrm->IsInFly() &&
+ (pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() &&
+ pFly->Lower() &&
+ !pFly->Lower()->IsNoTxtFrm() &&
+ !GetDrawView()->GetMarkList().GetMarkCount() )
+ {
+ return FALSE;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+// darf der Cursor in ReadOnlyBereiche?
+void SwCrsrShell::SetReadOnlyAvailable( BOOL bFlag )
+{
+ // im GlobalDoc darf NIE umgeschaltet werden
+ if( (!GetDoc()->GetDocShell() ||
+ !GetDoc()->GetDocShell()->IsA( SwGlobalDocShell::StaticType() )) &&
+ bFlag != bSetCrsrInReadOnly )
+ {
+ // wenn das Flag ausgeschaltet wird, dann muessen erstmal alle
+ // Selektionen aufgehoben werden. Denn sonst wird sich darauf
+ // verlassen, das nichts geschuetztes selektiert ist!
+ if( !bFlag )
+ {
+ ClearMark();
+ }
+ bSetCrsrInReadOnly = bFlag;
+ UpdateCrsr();
+ }
+}
+
+FASTBOOL SwCrsrShell::HasReadonlySel() const
+{
+ FASTBOOL bRet = FALSE;
+ if( IsReadOnlyAvailable() )
+ {
+ if( pTblCrsr )
+ bRet = pTblCrsr->HasReadOnlyBoxSel() ||
+ pTblCrsr->HasReadonlySel();
+ else
+ {
+ const SwPaM* pCrsr = pCurCrsr;
+
+ do {
+ if( pCrsr->HasReadonlySel() )
+ bRet = TRUE;
+ } while( !bRet && pCurCrsr != ( pCrsr = (SwPaM*)pCrsr->GetNext() ));
+ }
+ }
+ return bRet;
+}
+
+// SwCursor - Methode !!!!
+FASTBOOL SwCursor::IsReadOnlyAvailable() const
+{
+ const SwShellCrsr* pShCrsr = *this;
+ const SwUnoCrsr* pUnoCrsr = *this;
+ return pShCrsr ? pShCrsr->GetShell()->IsReadOnlyAvailable() :
+ pUnoCrsr ? TRUE : FALSE;
+}
+
+
+FASTBOOL SwCrsrShell::IsSelFullPara() const
+{
+ FASTBOOL bRet = FALSE;
+
+ if( pCurCrsr->GetPoint()->nNode.GetIndex() ==
+ pCurCrsr->GetMark()->nNode.GetIndex() && pCurCrsr == pCurCrsr->GetNext() )
+ {
+ xub_StrLen nStt = pCurCrsr->GetPoint()->nContent.GetIndex(),
+ nEnd = pCurCrsr->GetMark()->nContent.GetIndex();
+ if( nStt > nEnd )
+ {
+ xub_StrLen nTmp = nStt;
+ nStt = nEnd;
+ nEnd = nTmp;
+ }
+ const SwCntntNode* pCNd = pCurCrsr->GetCntntNode();
+ bRet = pCNd && !nStt && nEnd == pCNd->Len();
+ }
+ return bRet;
+}
+
+/* */
+
+ // die Suchfunktionen
+ULONG SwCrsrShell::Find( const SearchParam& rParam,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ FindRanges eRng, int bReplace )
+{
+ if( pTblCrsr )
+ GetCrsr();
+ delete pTblCrsr, pTblCrsr = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ ULONG nRet = pCurCrsr->Find( rParam, eStart, eEnde, eRng, bReplace );
+ if( nRet )
+ UpdateCrsr();
+ return nRet;
+}
+
+ULONG SwCrsrShell::Find( const SwTxtFmtColl& rFmtColl,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ FindRanges eRng, const SwTxtFmtColl* pReplFmt )
+{
+ if( pTblCrsr )
+ GetCrsr();
+ delete pTblCrsr, pTblCrsr = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ ULONG nRet = pCurCrsr->Find( rFmtColl, eStart, eEnde, eRng, pReplFmt );
+ if( nRet )
+ UpdateCrsr();
+ return nRet;
+}
+
+ULONG SwCrsrShell::Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ FindRanges eRng, const SearchParam* pTextPara,
+ const SfxItemSet* rReplSet )
+{
+ if( pTblCrsr )
+ GetCrsr();
+ delete pTblCrsr, pTblCrsr = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ ULONG nRet = pCurCrsr->Find( rSet, bNoCollections, eStart, eEnde,
+ eRng, pTextPara, rReplSet );
+ if( nRet )
+ UpdateCrsr();
+ return nRet;
+}
+
+void SwCrsrShell::SetSelection( const SwPaM& rCrsr )
+{
+ StartAction();
+ BOOL bFirst = TRUE;
+ SwPaM* pCrsr = GetCrsr();
+ *pCrsr->GetPoint() = *rCrsr.GetPoint();
+ if(rCrsr.HasMark())
+ {
+ pCrsr->SetMark();
+ *pCrsr->GetMark() = *rCrsr.GetMark();
+ }
+ if((SwPaM*)rCrsr.GetNext() != &rCrsr)
+ {
+ const SwPaM *_pStartCrsr = (SwPaM*)rCrsr.GetNext(), *__pStartCrsr = _pStartCrsr;
+ do
+ {
+ SwPaM* pCurCrsr = CreateCrsr();
+ *pCurCrsr->GetPoint() = *_pStartCrsr->GetPoint();
+ if(_pStartCrsr->HasMark())
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *_pStartCrsr->GetMark();
+ }
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rCrsr );
+ }
+ EndAction();
+}
+
+/* */
+
+#if !defined(PRODUCT) || defined(WIN)
+
+void SwCrsrShell::SetMark()
+{
+ pCurCrsr->SetMark();
+}
+
+FASTBOOL SwCrsrShell::HasMark()
+{
+ return pCurCrsr->HasMark();
+}
+
+SwCursor* SwCrsrShell::GetSwCrsr( FASTBOOL bMakeTblCrsr ) const
+{
+ return (SwCursor*)GetCrsr( bMakeTblCrsr );
+}
+
+// gebe den Stack Cursor zurueck
+SwPaM * SwCrsrShell::GetStkCrsr() const { return pCrsrStk; }
+
+// gebe den TabellenCrsr zurueck
+const SwPaM* SwCrsrShell::GetTblCrs() const { return pTblCrsr; }
+ SwPaM* SwCrsrShell::GetTblCrs() { return pTblCrsr; }
+
+// Abfrage, ob ueberhaupt eine Selektion existiert, sprich der akt. Cursor
+// aufgespannt oder nicht der einzigste ist.
+
+FASTBOOL SwCrsrShell::IsSelection() const
+{
+ return IsTableMode() || pCurCrsr->HasMark() ||
+ pCurCrsr->GetNext() != pCurCrsr;
+}
+
+// pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen
+const SwTableNode* SwCrsrShell::IsCrsrInTbl( BOOL bIsPtInTbl ) const
+{
+ return pCurCrsr->GetNode( bIsPtInTbl )->FindTableNode();
+}
+
+
+FASTBOOL SwCrsrShell::IsCrsrPtAtEnd() const
+{
+ return pCurCrsr->End() == pCurCrsr->GetPoint();
+}
+
+
+Point& SwCrsrShell::GetCrsrDocPos( BOOL bPoint ) const
+{
+ return bPoint ? pCurCrsr->GetPtPos() : pCurCrsr->GetMkPos();
+}
+
+
+void SwCrsrShell::UnSetVisCrsr()
+{
+ pVisCrsr->Hide();
+ pVisCrsr->SetDragCrsr( FALSE );
+}
+
+
+FASTBOOL SwCrsrShell::IsSelOnePara() const
+{
+ return pCurCrsr == pCurCrsr->GetNext() &&
+ pCurCrsr->GetPoint()->nNode ==
+ pCurCrsr->GetMark()->nNode;
+}
+
+SwMoveFnCollection* SwCrsrShell::MakeFindRange(
+ USHORT nStt, USHORT nEnd, SwPaM* pPam ) const
+{
+ return pCurCrsr->MakeFindRange( (SwDocPositions)nStt,
+ (SwDocPositions)nEnd, pPam );
+}
+
+#endif
+
+
+
+
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
new file mode 100644
index 000000000000..2d3a56fe263c
--- /dev/null
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -0,0 +1,1999 @@
+/*************************************************************************
+ *
+ * $RCSfile: crstrvl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-19 00:08:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PRECOMPILED
+#include "core_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+#ifndef _HINTIDS_HXX
+#include
+#endif
+
+#ifndef _SFXITEMITER_HXX //autogen
+#include
+#endif
+#ifndef _SVX_LRSPITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_ADJITEM_HXX //autogen
+#include
+#endif
+#ifndef _SVX_BRKITEM_HXX //autogen
+#include
+#endif
+
+#ifndef _CRSRSH_HXX
+#include
+#endif
+#ifndef _DOC_HXX
+#include
+#endif
+#ifndef _PAGEFRM_HXX
+#include
+#endif
+#ifndef _CNTFRM_HXX
+#include
+#endif
+#ifndef _ROOTFRM_HXX
+#include
+#endif
+#ifndef _PAM_HXX
+#include
+#endif
+#ifndef _NDTXT_HXX
+#include
+#endif
+#ifndef _FLDBAS_HXX
+#include
+#endif
+#ifndef _HINTS_HXX
+#include // SwTxtFld
+#endif
+#ifndef _SWTABLE_HXX
+#include // SwTxtFld
+#endif
+#ifndef _DOCARY_HXX
+#include
+#endif
+#ifndef _TXTFLD_HXX //autogen
+#include
+#endif
+#ifndef _FMTFLD_HXX //autogen
+#include
+#endif
+#ifndef _TXTFTN_HXX //autogen
+#include