summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 23:08:29 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 23:08:29 +0000
commit84a3db80b4fd66c6854b3135b5f69b61fd828e62 (patch)
tree4475006ca87946e71c44668b20330b2d2729f638 /sw/source/core
parent7b0b5cdfeed656b279bc32cd929630d5fc25878b (diff)
initial import
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/attr/calbck.cxx642
-rw-r--r--sw/source/core/attr/cellatr.cxx318
-rw-r--r--sw/source/core/attr/format.cxx677
-rw-r--r--sw/source/core/attr/hints.cxx299
-rw-r--r--sw/source/core/attr/makefile.mk101
-rw-r--r--sw/source/core/attr/swatrset.cxx380
-rw-r--r--sw/source/core/bastyp/bparr.cxx634
-rw-r--r--sw/source/core/bastyp/breakit.cxx109
-rw-r--r--sw/source/core/bastyp/calc.cxx1841
-rw-r--r--sw/source/core/bastyp/index.cxx772
-rw-r--r--sw/source/core/bastyp/init.cxx951
-rw-r--r--sw/source/core/bastyp/makefile.mk111
-rw-r--r--sw/source/core/bastyp/ring.cxx148
-rw-r--r--sw/source/core/bastyp/swcache.cxx699
-rw-r--r--sw/source/core/bastyp/swrect.cxx303
-rw-r--r--sw/source/core/bastyp/swregion.cxx293
-rw-r--r--sw/source/core/bastyp/swtypes.cxx270
-rw-r--r--sw/source/core/bastyp/tabcol.cxx127
-rw-r--r--sw/source/core/crsr/bookmrk.cxx180
-rw-r--r--sw/source/core/crsr/callnk.cxx302
-rw-r--r--sw/source/core/crsr/callnk.hxx88
-rw-r--r--sw/source/core/crsr/crbm.cxx281
-rw-r--r--sw/source/core/crsr/crsrsh.cxx2831
-rw-r--r--sw/source/core/crsr/crstrvl.cxx1999
-rw-r--r--sw/source/core/crsr/crstrvl1.cxx122
-rw-r--r--sw/source/core/crsr/findattr.cxx1463
-rw-r--r--sw/source/core/crsr/findcoll.cxx153
-rw-r--r--sw/source/core/crsr/findfmt.cxx124
-rw-r--r--sw/source/core/crsr/findtxt.cxx421
-rw-r--r--sw/source/core/crsr/makefile.mk148
-rw-r--r--sw/source/core/crsr/pam.cxx993
-rw-r--r--sw/source/core/crsr/paminit.cxx168
-rw-r--r--sw/source/core/crsr/swcrsr.cxx1736
-rw-r--r--sw/source/core/crsr/trvlcol.cxx168
-rw-r--r--sw/source/core/crsr/trvlfnfl.cxx521
-rw-r--r--sw/source/core/crsr/trvlreg.cxx345
-rw-r--r--sw/source/core/crsr/trvltbl.cxx770
-rw-r--r--sw/source/core/crsr/unocrsr.cxx290
-rw-r--r--sw/source/core/crsr/viscrs.cxx1078
-rw-r--r--sw/source/core/doc/acmplwrd.cxx303
-rw-r--r--sw/source/core/doc/doc.cxx1312
-rw-r--r--sw/source/core/doc/docbasic.cxx314
-rw-r--r--sw/source/core/doc/docbm.cxx1114
-rw-r--r--sw/source/core/doc/docchart.cxx489
-rw-r--r--sw/source/core/doc/doccomp.cxx1772
-rw-r--r--sw/source/core/doc/doccorr.cxx578
-rw-r--r--sw/source/core/doc/docdde.cxx525
-rw-r--r--sw/source/core/doc/docdesc.cxx1016
-rw-r--r--sw/source/core/doc/docdraw.cxx671
-rw-r--r--sw/source/core/doc/docedt.cxx2252
-rw-r--r--sw/source/core/doc/docfld.cxx2880
-rw-r--r--sw/source/core/doc/docfly.cxx1038
-rw-r--r--sw/source/core/doc/docfmt.cxx2167
-rw-r--r--sw/source/core/doc/docftn.cxx555
-rw-r--r--sw/source/core/doc/docglbl.cxx566
-rw-r--r--sw/source/core/doc/docglos.cxx189
-rw-r--r--sw/source/core/doc/doclay.cxx1924
-rw-r--r--sw/source/core/doc/docnew.cxx822
-rw-r--r--sw/source/core/doc/docnum.cxx2187
-rw-r--r--sw/source/core/doc/docredln.cxx3218
-rw-r--r--sw/source/core/doc/docsort.cxx1060
-rw-r--r--sw/source/core/doc/docstat.cxx105
-rw-r--r--sw/source/core/doc/doctxm.cxx2352
-rw-r--r--sw/source/core/doc/extinput.cxx286
-rw-r--r--sw/source/core/doc/fmtcol.cxx457
-rw-r--r--sw/source/core/doc/ftnidx.cxx480
-rw-r--r--sw/source/core/doc/gctable.cxx521
-rw-r--r--sw/source/core/doc/htmltbl.cxx1943
-rw-r--r--sw/source/core/doc/lineinfo.cxx182
-rw-r--r--sw/source/core/doc/makefile.mk176
-rw-r--r--sw/source/core/doc/notxtfrm.cxx1691
-rw-r--r--sw/source/core/doc/number.cxx1018
-rw-r--r--sw/source/core/doc/poolfmt.cxx2767
-rw-r--r--sw/source/core/doc/sortopt.cxx134
-rw-r--r--sw/source/core/doc/swserv.cxx419
-rw-r--r--sw/source/core/doc/tblafmt.cxx1055
-rw-r--r--sw/source/core/doc/tblcpy.cxx630
-rw-r--r--sw/source/core/doc/tblrwcl.cxx4508
-rw-r--r--sw/source/core/doc/visiturl.cxx201
-rw-r--r--sw/source/core/docnode/makefile.mk120
-rw-r--r--sw/source/core/docnode/ndcopy.cxx1260
-rw-r--r--sw/source/core/docnode/ndindex.cxx203
-rw-r--r--sw/source/core/docnode/ndnotxt.cxx184
-rw-r--r--sw/source/core/docnode/ndnum.cxx390
-rw-r--r--sw/source/core/docnode/ndsect.cxx1378
-rw-r--r--sw/source/core/docnode/ndtbl.cxx3824
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx1478
-rw-r--r--sw/source/core/docnode/node.cxx1840
-rw-r--r--sw/source/core/docnode/node2lay.cxx422
-rw-r--r--sw/source/core/docnode/nodes.cxx2604
-rw-r--r--sw/source/core/docnode/section.cxx1559
-rw-r--r--sw/source/core/docnode/swbaslnk.cxx850
-rw-r--r--sw/source/core/draw/dcontact.cxx774
-rw-r--r--sw/source/core/draw/dflyobj.cxx707
-rw-r--r--sw/source/core/draw/dobjfac.cxx100
-rw-r--r--sw/source/core/draw/dpage.cxx375
-rw-r--r--sw/source/core/draw/drawdoc.cxx279
-rw-r--r--sw/source/core/draw/dview.cxx688
-rw-r--r--sw/source/core/draw/makefile.mk102
-rw-r--r--sw/source/core/edit/acorrect.cxx628
-rw-r--r--sw/source/core/edit/autofmt.cxx2770
-rw-r--r--sw/source/core/edit/edatmisc.cxx234
-rw-r--r--sw/source/core/edit/edattr.cxx444
-rw-r--r--sw/source/core/edit/eddel.cxx466
-rw-r--r--sw/source/core/edit/edfcol.cxx194
-rw-r--r--sw/source/core/edit/edfld.cxx739
-rw-r--r--sw/source/core/edit/edfmt.cxx277
-rw-r--r--sw/source/core/edit/edglbldc.cxx470
-rw-r--r--sw/source/core/edit/edglss.cxx442
-rw-r--r--sw/source/core/edit/editsh.cxx1111
-rw-r--r--sw/source/core/edit/edlingu.cxx961
-rw-r--r--sw/source/core/edit/ednumber.cxx714
-rw-r--r--sw/source/core/edit/edredln.cxx228
-rw-r--r--sw/source/core/edit/edsect.cxx501
-rw-r--r--sw/source/core/edit/edtab.cxx713
-rw-r--r--sw/source/core/edit/edtox.cxx547
-rw-r--r--sw/source/core/edit/edundo.cxx312
-rw-r--r--sw/source/core/edit/edws.cxx443
-rw-r--r--sw/source/core/edit/makefile.mk145
-rw-r--r--sw/source/core/except/dbgloop.cxx201
-rw-r--r--sw/source/core/except/errhdl.cxx196
-rw-r--r--sw/source/core/except/makefile.mk97
-rw-r--r--sw/source/core/fields/authfld.cxx714
-rw-r--r--sw/source/core/fields/cellfml.cxx1305
-rw-r--r--sw/source/core/fields/chpfld.cxx297
-rw-r--r--sw/source/core/fields/dbfld.cxx1112
-rw-r--r--sw/source/core/fields/ddefld.cxx494
-rw-r--r--sw/source/core/fields/ddetbl.cxx240
-rw-r--r--sw/source/core/fields/docufld.cxx2485
-rw-r--r--sw/source/core/fields/expfld.cxx1309
-rw-r--r--sw/source/core/fields/fldbas.cxx1024
-rw-r--r--sw/source/core/fields/flddat.cxx364
-rw-r--r--sw/source/core/fields/fldlst.cxx278
-rw-r--r--sw/source/core/fields/macrofld.cxx226
-rw-r--r--sw/source/core/fields/makefile.mk125
-rw-r--r--sw/source/core/fields/reffld.cxx898
-rw-r--r--sw/source/core/fields/scrptfld.cxx182
-rw-r--r--sw/source/core/fields/tblcalc.cxx280
-rw-r--r--sw/source/core/fields/usrfld.cxx451
-rw-r--r--sw/source/core/frmedt/fecopy.cxx1431
-rw-r--r--sw/source/core/frmedt/fedesc.cxx327
-rw-r--r--sw/source/core/frmedt/fefly1.cxx1869
-rw-r--r--sw/source/core/frmedt/feflyole.cxx194
-rw-r--r--sw/source/core/frmedt/feshview.cxx2559
-rw-r--r--sw/source/core/frmedt/fetab.cxx1659
-rw-r--r--sw/source/core/frmedt/fews.cxx1000
-rw-r--r--sw/source/core/frmedt/makefile.mk112
-rw-r--r--sw/source/core/frmedt/tblsel.cxx2593
-rw-r--r--sw/source/core/graphic/grfatr.cxx417
-rw-r--r--sw/source/core/graphic/makefile.mk105
-rw-r--r--sw/source/core/graphic/ndgrf.cxx2061
-rw-r--r--sw/source/core/inc/acorrect.hxx157
-rw-r--r--sw/source/core/inc/blink.hxx126
-rw-r--r--sw/source/core/inc/bodyfrm.hxx89
-rw-r--r--sw/source/core/inc/cellfrm.hxx96
-rw-r--r--sw/source/core/inc/cntfrm.hxx196
-rw-r--r--sw/source/core/inc/colfrm.hxx83
-rw-r--r--sw/source/core/inc/dbg_lay.hxx144
-rw-r--r--sw/source/core/inc/dbgloop.hxx113
-rw-r--r--sw/source/core/inc/dflyobj.hxx156
-rw-r--r--sw/source/core/inc/docfld.hxx221
-rw-r--r--sw/source/core/inc/docsort.hxx201
-rw-r--r--sw/source/core/inc/doctxm.hxx176
-rw-r--r--sw/source/core/inc/drawdev.hxx174
-rw-r--r--sw/source/core/inc/drawfont.hxx348
-rw-r--r--sw/source/core/inc/dview.hxx119
-rw-r--r--sw/source/core/inc/flowfrm.hxx216
-rw-r--r--sw/source/core/inc/flyfrm.hxx248
-rw-r--r--sw/source/core/inc/flyfrms.hxx207
-rw-r--r--sw/source/core/inc/fntcache.hxx194
-rw-r--r--sw/source/core/inc/frame.hxx919
-rw-r--r--sw/source/core/inc/frminf.hxx119
-rw-r--r--sw/source/core/inc/frmtool.hxx457
-rw-r--r--sw/source/core/inc/ftnboss.hxx158
-rw-r--r--sw/source/core/inc/ftnfrm.hxx156
-rw-r--r--sw/source/core/inc/hffrm.hxx102
-rw-r--r--sw/source/core/inc/layact.hxx267
-rw-r--r--sw/source/core/inc/layfrm.hxx208
-rw-r--r--sw/source/core/inc/layouter.hxx98
-rw-r--r--sw/source/core/inc/makefile.mk61
-rw-r--r--sw/source/core/inc/mvsave.hxx250
-rw-r--r--sw/source/core/inc/node2lay.hxx110
-rw-r--r--sw/source/core/inc/noteurl.hxx116
-rw-r--r--sw/source/core/inc/notxtfrm.hxx119
-rw-r--r--sw/source/core/inc/pagefrm.hxx327
-rw-r--r--sw/source/core/inc/pamtyp.hxx140
-rw-r--r--sw/source/core/inc/ptqueue.hxx96
-rw-r--r--sw/source/core/inc/rootfrm.hxx342
-rw-r--r--sw/source/core/inc/rowfrm.hxx112
-rw-r--r--sw/source/core/inc/rvp_mark.hxx77
-rw-r--r--sw/source/core/inc/scrrect.hxx158
-rw-r--r--sw/source/core/inc/sectfrm.hxx197
-rw-r--r--sw/source/core/inc/swblocks.hxx260
-rw-r--r--sw/source/core/inc/swcache.hxx336
-rw-r--r--sw/source/core/inc/swfntcch.hxx133
-rw-r--r--sw/source/core/inc/swfont.hxx850
-rw-r--r--sw/source/core/inc/tabfrm.hxx190
-rw-r--r--sw/source/core/inc/tblrwcl.hxx263
-rw-r--r--sw/source/core/inc/txmsrt.hxx243
-rw-r--r--sw/source/core/inc/txtfrm.hxx639
-rw-r--r--sw/source/core/inc/txttypes.hxx75
-rw-r--r--sw/source/core/inc/unoclbck.hxx85
-rw-r--r--sw/source/core/inc/viewimp.hxx269
-rw-r--r--sw/source/core/inc/visiturl.hxx85
-rw-r--r--sw/source/core/inc/wrong.hxx121
-rw-r--r--sw/source/core/layout/atrfrm.cxx2519
-rw-r--r--sw/source/core/layout/calcmove.cxx1551
-rw-r--r--sw/source/core/layout/colfrm.cxx469
-rw-r--r--sw/source/core/layout/dbg_lay.cxx813
-rw-r--r--sw/source/core/layout/findfrm.cxx1116
-rw-r--r--sw/source/core/layout/flowfrm.cxx1837
-rw-r--r--sw/source/core/layout/fly.cxx2202
-rw-r--r--sw/source/core/layout/flycnt.cxx1970
-rw-r--r--sw/source/core/layout/flyincnt.cxx369
-rw-r--r--sw/source/core/layout/flylay.cxx997
-rw-r--r--sw/source/core/layout/flypos.cxx147
-rw-r--r--sw/source/core/layout/frmtool.cxx3171
-rw-r--r--sw/source/core/layout/ftnfrm.cxx2931
-rw-r--r--sw/source/core/layout/hffrm.cxx438
-rw-r--r--sw/source/core/layout/layact.cxx2741
-rw-r--r--sw/source/core/layout/layouter.cxx345
-rw-r--r--sw/source/core/layout/makefile.mk175
-rw-r--r--sw/source/core/layout/newfrm.cxx441
-rw-r--r--sw/source/core/layout/pagechg.cxx1955
-rw-r--r--sw/source/core/layout/pagedesc.cxx482
-rw-r--r--sw/source/core/layout/paintfrm.cxx3904
-rw-r--r--sw/source/core/layout/sectfrm.cxx2483
-rw-r--r--sw/source/core/layout/ssfrm.cxx345
-rw-r--r--sw/source/core/layout/tabfrm.cxx2573
-rw-r--r--sw/source/core/layout/trvlfrm.cxx2075
-rw-r--r--sw/source/core/layout/unusedf.cxx122
-rw-r--r--sw/source/core/layout/virtoutp.cxx247
-rw-r--r--sw/source/core/layout/virtoutp.hxx108
-rw-r--r--sw/source/core/layout/wsfrm.cxx3113
-rw-r--r--sw/source/core/makefile.mk326
-rw-r--r--sw/source/core/ole/makefile.mk93
-rw-r--r--sw/source/core/ole/ndole.cxx644
-rw-r--r--sw/source/core/para/makefile.mk93
-rw-r--r--sw/source/core/para/paratr.cxx349
-rw-r--r--sw/source/core/sw3io/makefile.mk136
-rw-r--r--sw/source/core/sw3io/swacorr.cxx145
-rw-r--r--sw/source/core/swg/makefile.mk124
-rw-r--r--sw/source/core/swg/swblocks.cxx955
-rw-r--r--sw/source/core/text/blink.cxx205
-rw-r--r--sw/source/core/text/frmcrsr.cxx1240
-rw-r--r--sw/source/core/text/frmform.cxx1919
-rw-r--r--sw/source/core/text/frminf.cxx409
-rw-r--r--sw/source/core/text/frmpaint.cxx738
-rw-r--r--sw/source/core/text/guess.cxx492
-rw-r--r--sw/source/core/text/guess.hxx123
-rw-r--r--sw/source/core/text/inftxt.cxx1176
-rw-r--r--sw/source/core/text/inftxt.hxx807
-rw-r--r--sw/source/core/text/itradj.cxx578
-rw-r--r--sw/source/core/text/itratr.cxx833
-rw-r--r--sw/source/core/text/itratr.hxx149
-rw-r--r--sw/source/core/text/itrcrsr.cxx923
-rw-r--r--sw/source/core/text/itrform2.cxx1491
-rw-r--r--sw/source/core/text/itrform2.hxx236
-rw-r--r--sw/source/core/text/itrpaint.cxx548
-rw-r--r--sw/source/core/text/itrpaint.hxx97
-rw-r--r--sw/source/core/text/itrtxt.cxx489
-rw-r--r--sw/source/core/text/itrtxt.hxx363
-rw-r--r--sw/source/core/text/makefile.mk185
-rw-r--r--sw/source/core/text/noteurl.cxx129
-rw-r--r--sw/source/core/text/pordrop.hxx122
-rw-r--r--sw/source/core/text/porexp.cxx332
-rw-r--r--sw/source/core/text/porexp.hxx131
-rw-r--r--sw/source/core/text/porfld.cxx854
-rw-r--r--sw/source/core/text/porfld.hxx240
-rw-r--r--sw/source/core/text/porfly.cxx585
-rw-r--r--sw/source/core/text/porfly.hxx140
-rw-r--r--sw/source/core/text/porftn.hxx150
-rw-r--r--sw/source/core/text/porglue.cxx363
-rw-r--r--sw/source/core/text/porglue.hxx174
-rw-r--r--sw/source/core/text/porhyph.hxx141
-rw-r--r--sw/source/core/text/porlay.cxx504
-rw-r--r--sw/source/core/text/porlay.hxx390
-rw-r--r--sw/source/core/text/porlin.cxx405
-rw-r--r--sw/source/core/text/porlin.hxx329
-rw-r--r--sw/source/core/text/porref.cxx139
-rw-r--r--sw/source/core/text/porref.hxx106
-rw-r--r--sw/source/core/text/porrst.cxx547
-rw-r--r--sw/source/core/text/porrst.hxx149
-rw-r--r--sw/source/core/text/portab.hxx159
-rw-r--r--sw/source/core/text/portox.cxx140
-rw-r--r--sw/source/core/text/portox.hxx108
-rw-r--r--sw/source/core/text/portxt.cxx745
-rw-r--r--sw/source/core/text/portxt.hxx139
-rw-r--r--sw/source/core/text/possiz.hxx120
-rw-r--r--sw/source/core/text/redlnitr.cxx558
-rw-r--r--sw/source/core/text/redlnitr.hxx150
-rw-r--r--sw/source/core/text/txtcache.cxx277
-rw-r--r--sw/source/core/text/txtcache.hxx113
-rw-r--r--sw/source/core/text/txtcfg.hxx209
-rw-r--r--sw/source/core/text/txtdrop.cxx800
-rw-r--r--sw/source/core/text/txtfld.cxx534
-rw-r--r--sw/source/core/text/txtfly.cxx1913
-rw-r--r--sw/source/core/text/txtfly.hxx275
-rw-r--r--sw/source/core/text/txtfrm.cxx1834
-rw-r--r--sw/source/core/text/txtftn.cxx1542
-rw-r--r--sw/source/core/text/txthyph.cxx910
-rw-r--r--sw/source/core/text/txtinit.cxx151
-rw-r--r--sw/source/core/text/txtio.cxx1134
-rw-r--r--sw/source/core/text/txtpaint.cxx144
-rw-r--r--sw/source/core/text/txtpaint.hxx259
-rw-r--r--sw/source/core/text/txttab.cxx537
-rw-r--r--sw/source/core/text/widorp.cxx525
-rw-r--r--sw/source/core/text/widorp.hxx125
-rw-r--r--sw/source/core/text/wrong.cxx370
-rw-r--r--sw/source/core/tox/makefile.mk103
-rw-r--r--sw/source/core/tox/tox.cxx1261
-rw-r--r--sw/source/core/tox/txmsrt.cxx818
-rw-r--r--sw/source/core/txtnode/atrfld.cxx376
-rw-r--r--sw/source/core/txtnode/atrflyin.cxx327
-rw-r--r--sw/source/core/txtnode/atrftn.cxx554
-rw-r--r--sw/source/core/txtnode/atrref.cxx151
-rw-r--r--sw/source/core/txtnode/atrtox.cxx144
-rw-r--r--sw/source/core/txtnode/chrfmt.cxx76
-rw-r--r--sw/source/core/txtnode/fmtatr1.cxx133
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx381
-rw-r--r--sw/source/core/txtnode/fntcache.cxx1208
-rw-r--r--sw/source/core/txtnode/fntcap.cxx658
-rw-r--r--sw/source/core/txtnode/makefile.mk145
-rw-r--r--sw/source/core/txtnode/ndhints.cxx464
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx2738
-rw-r--r--sw/source/core/txtnode/swfntcch.cxx123
-rw-r--r--sw/source/core/txtnode/swfont.cxx1103
-rw-r--r--sw/source/core/txtnode/thints.cxx2138
-rw-r--r--sw/source/core/txtnode/txatbase.cxx130
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx630
-rw-r--r--sw/source/core/txtnode/txtedt.cxx1040
-rw-r--r--sw/source/core/undo/docundo.cxx807
-rw-r--r--sw/source/core/undo/makefile.mk135
-rw-r--r--sw/source/core/undo/rolbck.cxx1488
-rw-r--r--sw/source/core/undo/unattr.cxx1356
-rw-r--r--sw/source/core/undo/unbkmk.cxx225
-rw-r--r--sw/source/core/undo/undel.cxx970
-rw-r--r--sw/source/core/undo/undobj.cxx1276
-rw-r--r--sw/source/core/undo/undobj1.cxx778
-rw-r--r--sw/source/core/undo/undraw.cxx779
-rw-r--r--sw/source/core/undo/unfmco.cxx202
-rw-r--r--sw/source/core/undo/unins.cxx1214
-rw-r--r--sw/source/core/undo/unmove.cxx505
-rw-r--r--sw/source/core/undo/unnum.cxx588
-rw-r--r--sw/source/core/undo/unoutl.cxx153
-rw-r--r--sw/source/core/undo/unovwr.cxx407
-rw-r--r--sw/source/core/undo/unredln.cxx579
-rw-r--r--sw/source/core/undo/unsect.cxx627
-rw-r--r--sw/source/core/undo/unsort.cxx422
-rw-r--r--sw/source/core/undo/unspnd.cxx380
-rw-r--r--sw/source/core/undo/untbl.cxx3123
-rw-r--r--sw/source/core/undo/untblk.cxx489
-rw-r--r--sw/source/core/unocore/makefile.mk152
-rw-r--r--sw/source/core/unocore/unobkm.cxx431
-rw-r--r--sw/source/core/unocore/unoclbck.cxx230
-rw-r--r--sw/source/core/unocore/unocoll.cxx2408
-rw-r--r--sw/source/core/unocore/unodraw.cxx1420
-rw-r--r--sw/source/core/unocore/unofield.cxx3230
-rw-r--r--sw/source/core/unocore/unoframe.cxx2669
-rw-r--r--sw/source/core/unocore/unoftn.cxx644
-rw-r--r--sw/source/core/unocore/unoidx.cxx2742
-rw-r--r--sw/source/core/unocore/unomap.cxx1921
-rw-r--r--sw/source/core/unocore/unoobj.cxx6024
-rw-r--r--sw/source/core/unocore/unoport.cxx704
-rw-r--r--sw/source/core/unocore/unoprnms.cxx529
-rw-r--r--sw/source/core/unocore/unorefmk.cxx496
-rw-r--r--sw/source/core/unocore/unosect.cxx858
-rw-r--r--sw/source/core/unocore/unosett.cxx2528
-rw-r--r--sw/source/core/unocore/unosrch.cxx889
-rw-r--r--sw/source/core/unocore/unostyle.cxx2861
-rw-r--r--sw/source/core/unocore/unotbl.cxx4783
-rw-r--r--sw/source/core/unocore/unotext.cxx1534
-rw-r--r--sw/source/core/view/makefile.mk111
-rw-r--r--sw/source/core/view/scrrect.cxx934
-rw-r--r--sw/source/core/view/vdraw.cxx606
-rw-r--r--sw/source/core/view/viewimp.cxx478
-rw-r--r--sw/source/core/view/viewpg.cxx1472
-rw-r--r--sw/source/core/view/viewsh.cxx2154
-rw-r--r--sw/source/core/view/vnew.cxx520
-rw-r--r--sw/source/core/view/vprint.cxx1924
380 files changed, 291878 insertions, 0 deletions
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 <float.h>
+#ifndef _HINTIDS_HXX
+#include <hintids.hxx> // fuer RES_..
+#endif
+
+#ifndef _CELLATR_HXX
+#include <cellatr.hxx>
+#endif
+#ifndef _CALC_HXX
+#include <calc.hxx>
+#endif
+#ifndef _FORMAT_HXX
+#include <format.hxx>
+#endif
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _SWTABLE_HXX
+#include <swtable.hxx>
+#endif
+#ifndef _NODE_HXX
+#include <node.hxx>
+#endif
+#ifndef _HINTS_HXX
+#include <hints.hxx>
+#endif
+#ifndef _ROLBCK_HXX
+#include <rolbck.hxx>
+#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 <hintids.hxx> // fuer RES_..
+#endif
+#ifndef _FRAME_HXX
+#include <frame.hxx> // fuer AttrCache
+#endif
+#ifndef _FORMAT_HXX
+#include <format.hxx>
+#endif
+
+#ifndef _HINTS_HXX
+#include <hints.hxx> // fuer SwFmtChg
+#endif
+#ifndef _PARATR_HXX
+#include <paratr.hxx> // fuer SwParaFmt - SwHyphenBug
+#endif
+#ifndef _SWCACHE_HXX
+#include <swcache.hxx>
+#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 <hintids.hxx>
+#endif
+#ifndef _SWTYPES_HXX
+#include <swtypes.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _ERRHDL_HXX
+#include <errhdl.hxx>
+#endif
+#ifndef _HINTS_HXX
+#include <hints.hxx>
+#endif
+#ifndef _SWERROR_H
+#include <error.h>
+#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 <hintids.hxx>
+
+#ifndef _SVX_COLRITEM_HXX //autogen
+#include <svx/colritem.hxx>
+#endif
+#ifndef _SVX_BRSHITEM_HXX //autogen
+#include <svx/brshitem.hxx>
+#endif
+#define ITEMID_LINE SID_ATTR_LINE_STYLE
+#ifndef _SVX_BOLNITEM_HXX //autogen
+#include <svx/bolnitem.hxx>
+#endif
+#ifndef _SVX_BOXITEM_HXX //autogen
+#include <svx/boxitem.hxx>
+#endif
+#ifndef _XTABLE_HXX //autogen
+#include <svx/xtable.hxx>
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include <offmgr/app.hxx>
+#endif
+
+#ifndef _FMTPDSC_HXX //autogen
+#include <fmtpdsc.hxx>
+#endif
+#ifndef _PAGEDESC_HXX //autogen
+#include <pagedesc.hxx>
+#endif
+#ifndef _CHARFMT_HXX
+#include <charfmt.hxx>
+#endif
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _NODE_HXX //autogen
+#include <node.hxx>
+#endif
+#ifndef _FORMAT_HXX //autogen
+#include <format.hxx>
+#endif
+#ifndef _SWATRSET_HXX
+#include <swatrset.hxx>
+#endif
+#ifndef _PARATR_HXX
+#include <paratr.hxx> // fuer SetModifyAtAttr
+#endif
+#ifndef _CELLATR_HXX
+#include <cellatr.hxx> // fuer SetModifyAtAttr
+#endif
+#ifndef _CMDID_H
+#include <cmdid.h>
+#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 <string.h>
+#include <limits.h>
+#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 <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#include <svx/unolingu.hxx>
+
+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 <ctype.h>
+#ifdef MAC
+#include <stdlib.h>
+#else
+#include <search.h>
+#endif
+#include <limits.h>
+#include <math.h>
+#include <float.h>
+
+#ifndef _HINTIDS_HXX
+#include <hintids.hxx>
+#endif
+
+#ifdef WNT
+#include <tools/svwin.h>
+#endif
+
+#ifndef _INTN_HXX //autogen
+#include <tools/intn.hxx>
+#endif
+#ifndef _TOOLS_SOLMATH_HXX
+#include <tools/solmath.hxx>
+#endif
+#ifndef _SV_SYSTEM_HXX
+#include <vcl/system.hxx>
+#endif
+#ifndef _APP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SBA_SBADB_HXX //autogen
+#include <offmgr/sbadb.hxx>
+#endif
+#ifndef _SBA_SBAOBJ_HXX //autogen
+#include <offmgr/sbaobj.hxx>
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include <offmgr/app.hxx>
+#endif
+#ifndef _SVX_ADRITEM_HXX //autogen
+#include <svx/adritem.hxx>
+#endif
+#ifndef _SVX_LANGITEM_HXX
+#include <svx/langitem.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+#ifndef _UNO_LINGU_HXX
+#include <svx/unolingu.hxx>
+#endif
+
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _VIEWSH_HXX
+#include <viewsh.hxx>
+#endif
+#ifndef _DOCSTAT_HXX //autogen
+#include <docstat.hxx>
+#endif
+#ifndef _CALC_HXX
+#include <calc.hxx>
+#endif
+#ifndef _SHELLRES_HXX
+#include <shellres.hxx>
+#endif
+#ifndef _DBFLD_HXX
+#include <dbfld.hxx>
+#endif
+#ifndef _EXPFLD_HXX
+#include <expfld.hxx>
+#endif
+#ifndef _USRFLD_HXX
+#include <usrfld.hxx>
+#endif
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#ifndef _DOCFLD_HXX
+#include <docfld.hxx>
+#endif
+#ifndef _FINDER_HXX
+#include <finder.hxx>
+#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 <stdio.h>
+
+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 <stdlib.h> // fuer qsort
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#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 <hintids.hxx>
+#endif
+
+#ifndef _GLOBNAME_HXX
+#include <tools/globname.hxx>
+#endif
+#ifndef _SV_MAPMOD_HXX
+#include <vcl/mapmod.hxx>
+#endif
+#ifndef _SYSTEM_HXX //autogen
+#include <vcl/system.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLCNITM_HXX
+#include <xmloff/xmlcnitm.hxx>
+#endif
+
+#ifndef _SFXMACITEM_HXX //autogen
+#include <svtools/macitem.hxx>
+#endif
+#ifndef _SVX_PBINITEM_HXX //autogen
+#include <svx/pbinitem.hxx>
+#endif
+#ifndef _SVX_KEEPITEM_HXX //autogen
+#include <svx/keepitem.hxx>
+#endif
+#ifndef _SVX_NLBKITEM_HXX //autogen
+#include <svx/nlbkitem.hxx>
+#endif
+#ifndef _SVX_HYZNITEM_HXX //autogen
+#include <svx/hyznitem.hxx>
+#endif
+#ifndef _SVX_PROTITEM_HXX //autogen
+#include <svx/protitem.hxx>
+#endif
+#ifndef _SVX_ULSPITEM_HXX //autogen
+#include <svx/ulspitem.hxx>
+#endif
+#ifndef _SVX_PRSZITEM_HXX //autogen
+#include <svx/prszitem.hxx>
+#endif
+#ifndef _SVX_OPAQITEM_HXX //autogen
+#include <svx/opaqitem.hxx>
+#endif
+#ifndef _SVX_SHADITEM_HXX //autogen
+#include <svx/shaditem.hxx>
+#endif
+#ifndef _SVX_PRNTITEM_HXX //autogen
+#include <svx/prntitem.hxx>
+#endif
+#ifndef _SVX_BRKITEM_HXX //autogen
+#include <svx/brkitem.hxx>
+#endif
+#ifndef _SVX_TSTPITEM_HXX //autogen
+#include <svx/tstpitem.hxx>
+#endif
+#ifndef _SVX_LANGITEM_HXX //autogen
+#include <svx/langitem.hxx>
+#endif
+#ifndef _SVX_WRLMITEM_HXX //autogen
+#include <svx/wrlmitem.hxx>
+#endif
+#ifndef _SVX_KERNITEM_HXX //autogen
+#include <svx/kernitem.hxx>
+#endif
+#ifndef _SVX_ESCPITEM_HXX //autogen
+#include <svx/escpitem.hxx>
+#endif
+#ifndef _SVX_CSCOITEM_HXX //autogen
+#include <svx/cscoitem.hxx>
+#endif
+#ifndef _SVX_LRSPITEM_HXX //autogen
+#include <svx/lrspitem.hxx>
+#endif
+#ifndef _SVX_ORPHITEM_HXX //autogen
+#include <svx/orphitem.hxx>
+#endif
+#ifndef _SVX_WIDWITEM_HXX //autogen
+#include <svx/widwitem.hxx>
+#endif
+#ifndef _SVX_NHYPITEM_HXX //autogen
+#include <svx/nhypitem.hxx>
+#endif
+#ifndef _SVX_SPLTITEM_HXX //autogen
+#include <svx/spltitem.hxx>
+#endif
+#ifndef _SVX_LSPCITEM_HXX //autogen
+#include <svx/lspcitem.hxx>
+#endif
+#ifndef _SVX_BLNKITEM_HXX //autogen
+#include <svx/blnkitem.hxx>
+#endif
+#ifndef _SVX_AKRNITEM_HXX //autogen
+#include <svx/akrnitem.hxx>
+#endif
+#ifndef _SVX_CMAPITEM_HXX //autogen
+#include <svx/cmapitem.hxx>
+#endif
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#ifndef _SVXSWAFOPT_HXX
+#include <svx/swafopt.hxx>
+#endif
+#ifndef _MySVXACORR_HXX //autogen
+#include <svx/svxacorr.hxx>
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include <offmgr/app.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+#ifndef _UNO_LINGU_HXX
+#include <svx/unolingu.hxx>
+#endif
+
+#ifndef _FMTHBSH_HXX //autogen
+#include <fmthbsh.hxx>
+#endif
+#ifndef _FMTANCHR_HXX //autogen
+#include <fmtanchr.hxx>
+#endif
+#ifndef _FMTORNT_HXX //autogen
+#include <fmtornt.hxx>
+#endif
+#ifndef _FMTSRND_HXX //autogen
+#include <fmtsrnd.hxx>
+#endif
+#ifndef _FMTFSIZE_HXX //autogen
+#include <fmtfsize.hxx>
+#endif
+#ifndef _FMTFLD_HXX //autogen
+#include <fmtfld.hxx>
+#endif
+#ifndef _FMTRFMRK_HXX //autogen
+#include <fmtrfmrk.hxx>
+#endif
+#ifndef _FMTTSPLT_HXX //autogen
+#include <fmtlsplt.hxx>
+#endif
+#ifndef _FMTEIRO_HXX //autogen
+#include <fmteiro.hxx>
+#endif
+#ifndef _FMTCLDS_HXX //autogen
+#include <fmtclds.hxx>
+#endif
+#ifndef _FMTURL_HXX //autogen
+#include <fmturl.hxx>
+#endif
+#ifndef _FMTCNTNT_HXX //autogen
+#include <fmtcntnt.hxx>
+#endif
+#ifndef _FMTHDFT_HXX //autogen
+#include <fmthdft.hxx>
+#endif
+#ifndef _FMTPDSC_HXX //autogen
+#include <fmtpdsc.hxx>
+#endif
+#ifndef _FMTFTN_HXX //autogen
+#include <fmtftn.hxx>
+#endif
+#ifndef _FMTFORDR_HXX //autogen
+#include <fmtfordr.hxx>
+#endif
+#ifndef _FMTFLCNT_HXX //autogen
+#include <fmtflcnt.hxx>
+#endif
+#ifndef _FCHRFMT_HXX //autogen
+#include <fchrfmt.hxx>
+#endif
+#ifndef _FMTINFMT_HXX //autogen
+#include <fmtinfmt.hxx>
+#endif
+#ifndef _FMTCNCT_HXX //autogen
+#include <fmtcnct.hxx>
+#endif
+#ifndef _FMTLINE_HXX
+#include <fmtline.hxx>
+#endif
+#ifndef _FMTFTNTX_HXX
+#include <fmtftntx.hxx>
+#endif
+#ifndef _EDITSH_HXX
+#include <editsh.hxx>
+#endif
+#ifndef _PAM_HXX
+#include <pam.hxx>
+#endif
+#ifndef _INIT_HXX
+#include <init.hxx>
+#endif
+#ifndef _PARATR_HXX
+#include <paratr.hxx>
+#endif
+#ifndef _GRFATR_HXX
+#include <grfatr.hxx>
+#endif
+#ifndef _TOX_HXX
+#include <tox.hxx>
+#endif
+#ifndef _CELLATR_HXX
+#include <cellatr.hxx>
+#endif
+#ifndef _TBLAFMT_HXX
+#include <tblafmt.hxx>
+#endif
+#ifndef _VISCRS_HXX
+#include <viscrs.hxx>
+#endif
+#ifndef _FNTCACHE_HXX
+#include <fntcache.hxx>
+#endif
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _NUMRULE_HXX
+#include <numrule.hxx>
+#endif
+#ifndef _ACMPLWRD_HXX
+#include <acmplwrd.hxx>
+#endif
+#ifndef _FMTCLBL_HXX
+#include <fmtclbl.hxx>
+#endif
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _BREAKIT_HXX
+#include <breakit.hxx>
+#endif
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+
+#ifndef _GRFCACHE_HXX
+#include <grfcache.hxx>
+#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 <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_TEMPFILE_HXX
+#include <tools/tempfile.hxx>
+#endif
+#include "errhdl.hxx"
+#include "swcache.hxx"
+
+#ifndef PRODUCT
+ #include <stdlib.h> // getenv()
+ #include <stdio.h> // 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 <tools/stream.hxx>
+#endif
+#endif
+#include <stdlib.h>
+#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 <tools/debug.hxx>
+#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 <vcl/window.hxx>
+#endif
+#ifndef _SV_GRAPH_HXX //autogen
+#include <vcl/graph.hxx>
+#endif
+#ifndef _OFF_APP_HXX //autogen
+#include <offmgr/app.hxx>
+#endif
+#ifndef _OFA_OSPLCFG_HXX //autogen
+#include <offmgr/osplcfg.hxx>
+#endif
+
+#ifndef _SFXINIMGR_HXX
+#include <svtools/iniman.hxx>
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LINGUISTIC_XSPELLCHECKER1_HPP_
+#include <com/sun/star/linguistic/XSpellChecker1.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LINGUISTIC_XHYPHENATOR_HPP_
+#include <com/sun/star/linguistic/XHyphenator.hpp>
+#endif
+#ifndef _UNO_LINGU_HXX
+#include <svx/unolingu.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LINGUISTIC_XTHESAURUS_HPP_
+#include <com/sun/star/linguistic/XThesaurus.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _PAGEFRM_HXX
+#include <pagefrm.hxx>
+#endif
+#ifndef _SWATRSET_HXX
+#include <swatrset.hxx>
+#endif
+#ifndef _FRMFMT_HXX
+#include <frmfmt.hxx>
+#endif
+#ifndef _FRMTOOL_HXX
+#include <frmtool.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _UNDOBJ_HXX
+#include <undobj.hxx>
+#endif
+#ifndef _SWTABLE_HXX
+#include <swtable.hxx>
+#endif
+#ifndef _VISCRS_HXX
+#include <viscrs.hxx>
+#endif
+#ifndef _FNTCACHE_HXX
+#include <fntcache.hxx>
+#endif
+#ifndef _SWFNTCCH_HXX
+#include <swfntcch.hxx>
+#endif
+#ifndef _HFFRM_HXX
+#include <hffrm.hxx>
+#endif
+#ifndef _COLFRM_HXX
+#include <colfrm.hxx>
+#endif
+#ifndef _BODYFRM_HXX
+#include <bodyfrm.hxx>
+#endif
+#ifndef _TABFRM_HXX
+#include <tabfrm.hxx>
+#endif
+#ifndef _TXTFRM_HXX
+#include <txtfrm.hxx>
+#endif
+#ifndef _SWTBLFMT_HXX
+#include <swtblfmt.hxx>
+#endif
+#ifndef _ROWFRM_HXX
+#include <rowfrm.hxx>
+#endif
+#ifndef _CELLFRM_HXX
+#include <cellfrm.hxx>
+#endif
+#ifndef _SECTFRM_HXX
+#include <sectfrm.hxx>
+#endif
+
+// ! Code for the new GraphicObject
+#ifndef USE_GRFOBJECT
+
+#ifndef _GRFCACHE_HXX
+#include <grfcache.hxx>
+#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 <errhdl.hxx>
+#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 <hintids.hxx>
+#endif
+
+#ifndef _FMTCNTNT_HXX //autogen
+#include <fmtcntnt.hxx>
+#endif
+#ifndef _TXATBASE_HXX //autogen
+#include <txatbase.hxx>
+#endif
+#ifndef _FRMATR_HXX
+#include <frmatr.hxx>
+#endif
+#ifndef _VISCRS_HXX
+#include <viscrs.hxx>
+#endif
+#ifndef _CALLNK_HXX
+#include <callnk.hxx>
+#endif
+#ifndef _CRSRSH_HXX
+#include <crsrsh.hxx>
+#endif
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _FRMFMT_HXX
+#include <frmfmt.hxx>
+#endif
+#ifndef _TXTFRM_HXX
+#include <txtfrm.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _FLYFRM_HXX
+#include <flyfrm.hxx>
+#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 <tools/solar.h>
+
+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 <docary.hxx>
+#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 <hintids.hxx>
+#endif
+
+#ifndef _SVDMODEL_HXX //autogen
+#include <svx/svdmodel.hxx>
+#endif
+
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _ROOTFRM_HXX
+#include <rootfrm.hxx>
+#endif
+#ifndef _PAGEFRM_HXX
+#include <pagefrm.hxx>
+#endif
+#ifndef _CNTFRM_HXX
+#include <cntfrm.hxx>
+#endif
+#ifndef _VIEWIMP_HXX
+#include <viewimp.hxx>
+#endif
+#ifndef _ERRHDL_HXX
+#include <errhdl.hxx> // fuer ASSERT
+#endif
+#ifndef _PAM_HXX
+#include <pam.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _FLYFRM_HXX
+#include <flyfrm.hxx>
+#endif
+#ifndef _DVIEW_HXX
+#include <dview.hxx>
+#endif
+#ifndef _VIEWOPT_HXX
+#include <viewopt.hxx>
+#endif
+#ifndef _FRMTOOL_HXX
+#include <frmtool.hxx>
+#endif
+#ifndef _CRSRSH_HXX
+#include <crsrsh.hxx>
+#endif
+#ifndef _TABFRM_HXX
+#include <tabfrm.hxx>
+#endif
+#ifndef _TXTFRM_HXX
+#include <txtfrm.hxx>
+#endif
+#ifndef _SWTABLE_HXX
+#include <swtable.hxx>
+#endif
+#ifndef _CALLNK_HXX
+#include <callnk.hxx>
+#endif
+#ifndef _VISCRS_HXX
+#include <viscrs.hxx>
+#endif
+#ifndef _SECTION_HXX
+#include <section.hxx>
+#endif
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#ifndef _SWGLOBDOCSH_HXX //autogen
+#include <globdoc.hxx>
+#endif
+#ifndef _PAMTYP_HXX
+#include <pamtyp.hxx>
+#endif
+#ifndef _MDIEXP_HXX
+#include <mdiexp.hxx> // ...Percent()
+#endif
+#ifndef _FMTEIRO_HXX //autogen
+#include <fmteiro.hxx>
+#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 <hintids.hxx>
+#endif
+
+#ifndef _SFXITEMITER_HXX //autogen
+#include <svtools/itemiter.hxx>
+#endif
+#ifndef _SVX_LRSPITEM_HXX //autogen
+#include <svx/lrspitem.hxx>
+#endif
+#ifndef _SVX_ADJITEM_HXX //autogen
+#include <svx/adjitem.hxx>
+#endif
+#ifndef _SVX_BRKITEM_HXX //autogen
+#include <svx/brkitem.hxx>
+#endif
+
+#ifndef _CRSRSH_HXX
+#include <crsrsh.hxx>
+#endif
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _PAGEFRM_HXX
+#include <pagefrm.hxx>
+#endif
+#ifndef _CNTFRM_HXX
+#include <cntfrm.hxx>
+#endif
+#ifndef _ROOTFRM_HXX
+#include <rootfrm.hxx>
+#endif
+#ifndef _PAM_HXX
+#include <pam.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _FLDBAS_HXX
+#include <fldbas.hxx>
+#endif
+#ifndef _HINTS_HXX
+#include <hints.hxx> // SwTxtFld
+#endif
+#ifndef _SWTABLE_HXX
+#include <swtable.hxx> // SwTxtFld
+#endif
+#ifndef _DOCARY_HXX
+#include <docary.hxx>
+#endif
+#ifndef _TXTFLD_HXX //autogen
+#include <txtfld.hxx>
+#endif
+#ifndef _FMTFLD_HXX //autogen
+#include <fmtfld.hxx>
+#endif
+#ifndef _TXTFTN_HXX //autogen
+#include <txtftn.hxx>
+#endif
+#ifndef _TXTINET_HXX //autogen
+#include <txtinet.hxx>
+#endif
+#ifndef _FMTINFMT_HXX //autogen
+#include <fmtinfmt.hxx>
+#endif
+#ifndef _TXTTXMRK_HXX //autogen
+#include <txttxmrk.hxx>
+#endif
+#ifndef _FRMFMT_HXX //autogen
+#include <frmfmt.hxx>
+#endif
+#ifndef _VISCRS_HXX
+#include <viscrs.hxx>
+#endif
+#ifndef _CALLNK_HXX
+#include <callnk.hxx>
+#endif
+#ifndef _DOCTXM_HXX
+#include <doctxm.hxx>
+#endif
+#ifndef _DOCFLD_HXX
+#include <docfld.hxx>
+#endif
+#ifndef _EXPFLD_HXX
+#include <expfld.hxx>
+#endif
+#ifndef _REFFLD_HXX
+#include <reffld.hxx>
+#endif
+#ifndef _FLDDAT_HXX
+#include <flddat.hxx> // SwTxtFld
+#endif
+#ifndef _CELLATR_HXX
+#include <cellatr.hxx>
+#endif
+#ifndef _SWUNDO_HXX
+#include <swundo.hxx>
+#endif
+#ifndef _REDLINE_HXX
+#include <redline.hxx>
+#endif
+#ifndef _FMTCNTNT_HXX //autogen
+#include <fmtcntnt.hxx>
+#endif
+#ifndef _FMTHDFT_HXX //autogen
+#include <fmthdft.hxx>
+#endif
+#ifndef _PAGEDESC_HXX //autogen
+#include <pagedesc.hxx>
+#endif
+
+
+// zum naechsten/vorhergehenden Punkt auf gleicher Ebene
+FASTBOOL SwCrsrShell::GotoNextNum()
+{
+ FASTBOOL bRet = GetDoc()->GotoNextNum( *pCurCrsr->GetPoint() );
+ if( bRet )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ if( !ActionPend() )
+ {
+ SET_CURR_SHELL( this );
+ // dann versuche den Cursor auf die Position zu setzen,
+ // auf halber Heohe vom Char-SRectangle
+ Point aPt( pCurCrsr->GetPtPos() );
+ SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->GetFrm( &aPt,
+ pCurCrsr->GetPoint() );
+ pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
+ aPt.Y() = aCharRect.Center().Y();
+ pFrm->Calc();
+ aPt.X() = pFrm->Frm().Left() + nUpDownX;
+ pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+ bRet = !pCurCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS );
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::UPDOWN |
+ SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ }
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::GotoPrevNum()
+{
+ FASTBOOL bRet = GetDoc()->GotoPrevNum( *pCurCrsr->GetPoint() );
+ if( bRet )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ if( !ActionPend() )
+ {
+ SET_CURR_SHELL( this );
+ // dann versuche den Cursor auf die Position zu setzen,
+ // auf halber Heohe vom Char-SRectangle
+ Point aPt( pCurCrsr->GetPtPos() );
+ SwCntntFrm * pFrm = pCurCrsr->GetCntntNode()->GetFrm( &aPt,
+ pCurCrsr->GetPoint() );
+ pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint() );
+ aPt.Y() = aCharRect.Center().Y();
+ pFrm->Calc();
+ aPt.X() = pFrm->Frm().Left() + nUpDownX;
+ pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+ bRet = !pCurCrsr->IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS );
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::UPDOWN |
+ SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ }
+ return bRet;
+}
+
+// springe aus dem Content zum Header
+
+FASTBOOL SwCrsrShell::GotoHeaderTxt()
+{
+ const SwFrm* pFrm = GetCurrFrm()->FindPageFrm();
+ while( pFrm && !pFrm->IsHeaderFrm() )
+ pFrm = pFrm->GetLower();
+ // Header gefunden, dann suche den 1.Cntnt-Frame
+ while( pFrm && !pFrm->IsCntntFrm() )
+ pFrm = pFrm->GetLower();
+ if( pFrm )
+ {
+ SET_CURR_SHELL( this );
+ // hole den Header-Frame
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pFrm->Calc();
+ Point aPt( pFrm->Frm().Pos() + pFrm->Prt().Pos() );
+ pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+ if( !pCurCrsr->IsSelOvr() )
+ {
+#ifdef USED
+ // wenn wir immer auf der akt. Seite bleiben wollen, dann benutzen.
+ // zur Zeit immer zur naechst gelegene !!
+ // diese Seite, diese Fusszeile !!
+ // diese Seite, diese Kopfzeile !!
+ pCurCrsr->GetPtPos() = aPt;
+#endif
+ UpdateCrsr();
+ }
+ else
+ pFrm = 0;
+ }
+ return 0 != pFrm;
+}
+
+
+// springe aus dem Content zum Footer
+
+FASTBOOL SwCrsrShell::GotoFooterTxt()
+{
+ const SwPageFrm* pFrm = GetCurrFrm()->FindPageFrm();
+ if( pFrm )
+ {
+ const SwFrm * pLower = pFrm->GetLower();
+ while( pLower->GetNext() )
+ pLower = pLower->GetNext();
+
+ while( pLower && !pLower->IsFooterFrm() )
+ pLower = pLower->GetLower();
+ // Header gefunden, dann suche den 1.Cntnt-Frame
+ while( pLower && !pLower->IsCntntFrm() )
+ pLower = pLower->GetLower();
+
+ if( pLower )
+ {
+ SET_CURR_SHELL( this );
+ // hole eine Position im Footer
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pLower->Calc();
+ Point aPt( pLower->Frm().Pos() + pLower->Prt().Pos() );
+ pLower->GetCrsrOfst( pCurCrsr->GetPoint(), aPt );
+ if( !pCurCrsr->IsSelOvr() )
+ {
+#ifdef USED
+ // wenn wir immer auf der akt. Seite bleiben wollen, dann benutzen.
+ // zur Zeit immer zur naechst gelegene !!
+ // diese Seite, diese Fusszeile !!
+ pCurCrsr->GetPtPos() = aPt;
+#endif
+ UpdateCrsr();
+ }
+ else
+ pFrm = 0;
+ }
+ else
+ pFrm = 0;
+ }
+ else
+ pFrm = 0;
+ return 0 != pFrm;
+}
+
+FASTBOOL SwCrsrShell::SetCrsrInHdFt( USHORT nDescNo, FASTBOOL bInHeader )
+{
+ FASTBOOL bRet = FALSE;
+ SwDoc *pDoc = GetDoc();
+
+ SET_CURR_SHELL( this );
+
+ if( USHRT_MAX == nDescNo )
+ {
+ // dann den akt. nehmen
+ const SwPageFrm* pPage = GetCurrFrm()->FindPageFrm();
+ if( pPage )
+ for( USHORT i = 0; i < pDoc->GetPageDescCnt(); ++i )
+ if( pPage->GetPageDesc() == &pDoc->GetPageDesc( i ) )
+ {
+ nDescNo = i;
+ break;
+ }
+ }
+
+ if( USHRT_MAX != nDescNo && nDescNo < pDoc->GetPageDescCnt() )
+ {
+ //dann teste mal, ob ueberhaupt das Attribut vorhanden ist.
+ const SwPageDesc& rDesc = pDoc->GetPageDesc( nDescNo );
+ const SwFmtCntnt* pCnt = 0;
+ if( bInHeader )
+ {
+ // gespiegelte Seiten??? erstmal nicht beachten
+ const SwFmtHeader& rHd = rDesc.GetMaster().GetHeader();
+ if( rHd.GetHeaderFmt() )
+ pCnt = &rHd.GetHeaderFmt()->GetCntnt();
+ }
+ else
+ {
+ const SwFmtFooter& rFt = rDesc.GetMaster().GetFooter();
+ if( rFt.GetFooterFmt() )
+ pCnt = &rFt.GetFooterFmt()->GetCntnt();
+ }
+
+ if( pCnt && pCnt->GetCntntIdx() )
+ {
+ SwNodeIndex aIdx( *pCnt->GetCntntIdx(), 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = pDoc->GetNodes().GoNext( &aIdx );
+
+ const SwFrm* pFrm;
+ Point aPt( pCurCrsr->GetPtPos() );
+
+ if( pCNd && 0 != ( pFrm = pCNd->GetFrm( &aPt, 0, FALSE ) ))
+ {
+ // dann kann der Cursor ja auch hinein gesetzt werden
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ ClearMark();
+
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+ rPos.nNode = *pCNd;
+ rPos.nContent.Assign( pCNd, 0 );
+
+ bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ }
+ }
+ return bRet;
+}
+
+// springe zum naechsten Verzeichnis
+
+FASTBOOL SwCrsrShell::GotoNextTOXBase( const String* pName )
+{
+ FASTBOOL bRet = FALSE;
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ SwCntntNode* pFnd = 0;
+ for( USHORT n = rFmts.Count(); n; )
+ {
+ const SwSection* pSect = rFmts[ --n ]->GetSection();
+ const SwSectionNode* pSectNd;
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
+ pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex() &&
+ ( !pFnd || pFnd->GetIndex() > pSectNd->GetIndex() ) &&
+// JP 10.12.96: solange wir nur 3 Typen kennen und UI-seitig keine anderen
+// einstellbar sind, muss ueber den Titel gesucht werden!
+// ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTypeName() ) &&
+ ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
+ )
+ {
+ SwNodeIndex aIdx( *pSectNd, 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ const SwCntntFrm* pCFrm;
+ if( pCNd &&
+ pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
+ 0 != ( pCFrm = pCNd->GetFrm() ) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ pFnd = pCNd;
+ }
+ }
+ }
+ if( pFnd )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *pFnd;
+ pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
+ bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+// springe zum vorherigen Verzeichnis
+
+
+FASTBOOL SwCrsrShell::GotoPrevTOXBase( const String* pName )
+{
+ FASTBOOL bRet = FALSE;
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ SwCntntNode* pFnd = 0;
+ for( USHORT n = rFmts.Count(); n; )
+ {
+ const SwSection* pSect = rFmts[ --n ]->GetSection();
+ const SwSectionNode* pSectNd;
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) &&
+ pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex() &&
+ ( !pFnd || pFnd->GetIndex() < pSectNd->GetIndex() ) &&
+// JP 10.12.96: solange wir nur 3 Typen kennen und UI-seitig keine anderen
+// einstellbar sind, muss ueber den Titel gesucht werden!
+// ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTypeName() ) &&
+ ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() )
+ )
+ {
+ SwNodeIndex aIdx( *pSectNd, 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ const SwCntntFrm* pCFrm;
+ if( pCNd &&
+ pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() &&
+ 0 != ( pCFrm = pCNd->GetFrm() ) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ pFnd = pCNd;
+ }
+ }
+ }
+
+ if( pFnd )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *pFnd;
+ pCurCrsr->GetPoint()->nContent.Assign( pFnd, 0 );
+ bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+// springe zum Verzeichnis vom TOXMark
+
+FASTBOOL SwCrsrShell::GotoTOXMarkBase()
+{
+ FASTBOOL bRet = FALSE;
+
+ SwTOXMarks aMarks;
+ USHORT nCnt = GetDoc()->GetCurTOXMark( *pCurCrsr->GetPoint(), aMarks );
+ if( nCnt )
+ {
+ // dann nehme den 1. und hole den Verzeichnis-Typ.
+ // Suche in seiner Abhaengigkeitsliste nach dem eigentlichem
+ // Verzeichnis
+ SwModify* pType = (SwModify*)aMarks[0]->GetRegisteredIn();
+ SwClientIter aIter( *pType );
+ const SwSectionNode* pSectNd;
+ const SwSectionFmt* pSectFmt;
+
+ for( SwTOXBase* pTOX =
+ (SwTOXBase*)aIter.First( TYPE( SwTOXBase ));
+ pTOX; pTOX = (SwTOXBase*)aIter.Next() )
+ if( pTOX->ISA( SwTOXBaseSection ) &&
+ 0 != ( pSectFmt = ((SwTOXBaseSection*)pTOX)->GetFmt() ) &&
+ 0 != ( pSectNd = pSectFmt->GetSectionNode() ))
+ {
+ SwNodeIndex aIdx( *pSectNd, 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ const SwCntntFrm* pCFrm;
+ if( pCNd &&
+ pCNd->EndOfSectionIndex() < pSectNd->EndOfSectionIndex() &&
+ 0 != ( pCFrm = pCNd->GetFrm() ) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *pCNd;
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+ bRet = !pCurCrsr->IsInProtectTable() &&
+ !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ break;
+ }
+ }
+ }
+ return bRet;
+}
+
+
+ // springe zur naechsten (vorherigen) Tabellenformel
+ // optional auch nur zu kaputten Formeln springen
+FASTBOOL SwCrsrShell::GotoNxtPrvTblFormula( BOOL bNext, BOOL bOnlyErrors )
+{
+ if( IsTableMode() )
+ return FALSE;
+
+ FASTBOOL bFnd = FALSE;
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+
+ Point aPt;
+ SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
+ if( !bNext )
+ aFndPos.nNode = 0;
+ _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
+
+ {
+ const SwNode* pSttNd = rPos.nNode.GetNode().FindTableBoxStartNode();
+ if( pSttNd )
+ {
+ const SwTableBox* pTBox = pSttNd->FindTableNode()->GetTable().
+ GetTblBox( pSttNd->GetIndex() );
+ if( pTBox )
+ aCurGEF = _SetGetExpFld( *pTBox );
+ }
+ }
+
+ if( rPos.nNode < GetDoc()->GetNodes().GetEndOfExtras() )
+ // auch beim Einsammeln wird nur der erste Frame benutzt!
+ aCurGEF.SetBodyPos( *rPos.nNode.GetNode().GetCntntNode()->GetFrm(
+ &aPt, &rPos, FALSE ) );
+
+ {
+ const SfxPoolItem* pItem;
+ const SwTableBox* pTBox;
+ USHORT n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount( RES_BOXATR_FORMULA );
+
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem(
+ RES_BOXATR_FORMULA, n ) ) &&
+ 0 != (pTBox = ((SwTblBoxFormula*)pItem)->GetTableBox() ) &&
+ pTBox->GetSttNd() &&
+ pTBox->GetSttNd()->GetNodes().IsDocNodes() &&
+ ( !bOnlyErrors ||
+ !((SwTblBoxFormula*)pItem)->HasValidBoxes() ) )
+ {
+ const SwCntntFrm* pCFrm;
+ SwNodeIndex aIdx( *pTBox->GetSttNd() );
+ const SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ if( pCNd && 0 != ( pCFrm = pCNd->GetFrm( &aPt, 0, FALSE ) ) &&
+ (IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ _SetGetExpFld aCmp( *pTBox );
+ aCmp.SetBodyPos( *pCFrm );
+
+ if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
+ : ( aCmp < aCurGEF && aFndGEF < aCmp ))
+ {
+ aFndGEF = aCmp;
+ bFnd = TRUE;
+ }
+ }
+ }
+ }
+
+ if( bFnd )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ aFndGEF.GetPosOfContent( rPos );
+ pCurCrsr->DeleteMark();
+
+ bFnd = !pCurCrsr->IsSelOvr();
+ if( bFnd )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ return bFnd;
+}
+
+// springe zum naechsten (vorherigen) Verzeichniseintrag
+FASTBOOL SwCrsrShell::GotoNxtPrvTOXMark( BOOL bNext )
+{
+ if( IsTableMode() )
+ return FALSE;
+
+ FASTBOOL bFnd = FALSE;
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+
+ Point aPt;
+ SwPosition aFndPos( GetDoc()->GetNodes().GetEndOfContent() );
+ if( !bNext )
+ aFndPos.nNode = 0;
+ _SetGetExpFld aFndGEF( aFndPos ), aCurGEF( rPos );
+
+ if( rPos.nNode.GetIndex() < GetDoc()->GetNodes().GetEndOfExtras().GetIndex() )
+ // auch beim Einsammeln wird nur der erste Frame benutzt!
+ aCurGEF.SetBodyPos( *rPos.nNode.GetNode().
+ GetCntntNode()->GetFrm( &aPt, &rPos, FALSE ) );
+
+ {
+ const SfxPoolItem* pItem;
+ const SwCntntFrm* pCFrm;
+ const SwTxtNode* pTxtNd;
+ const SwTxtTOXMark* pTxtTOX;
+ USHORT n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount( RES_TXTATR_TOXMARK );
+
+ for( n = 0; n < nMaxItems; ++n )
+ if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem(
+ RES_TXTATR_TOXMARK, n ) ) &&
+ 0 != (pTxtTOX = ((SwTOXMark*)pItem)->GetTxtTOXMark() ) &&
+ ( pTxtNd = &pTxtTOX->GetTxtNode())->GetNodes().IsDocNodes() &&
+ 0 != ( pCFrm = pTxtNd->GetFrm( &aPt, 0, FALSE )) &&
+ ( IsReadOnlyAvailable() || !pCFrm->IsProtected() ))
+ {
+ SwNodeIndex aNdIndex( *pTxtNd ); // UNIX benoetigt dieses Obj.
+ _SetGetExpFld aCmp( aNdIndex, *pTxtTOX, 0 );
+ aCmp.SetBodyPos( *pCFrm );
+
+ if( bNext ? ( aCurGEF < aCmp && aCmp < aFndGEF )
+ : ( aCmp < aCurGEF && aFndGEF < aCmp ))
+ {
+ aFndGEF = aCmp;
+ bFnd = TRUE;
+ }
+ }
+ }
+
+ if( bFnd )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ aFndGEF.GetPosOfContent( rPos );
+
+ bFnd = !pCurCrsr->IsSelOvr();
+ if( bFnd )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+ }
+ return bFnd;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveling zwischen Markierungen
+ --------------------------------------------------------------------*/
+
+const SwTOXMark& SwCrsrShell::GotoTOXMark( const SwTOXMark& rStart,
+ SwTOXSearch eDir )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ const SwTOXMark& rNewMark = GetDoc()->GotoTOXMark( rStart, eDir,
+ IsReadOnlyAvailable() );
+ // Position setzen
+ SwPosition& rPos = *GetCrsr()->GetPoint();
+ rPos.nNode = rNewMark.GetTxtTOXMark()->GetTxtNode();
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
+ *rNewMark.GetTxtTOXMark()->GetStart() );
+
+ if( !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE |
+ SwCrsrShell::READONLY );
+
+ return rNewMark;
+}
+
+// springe zum naechsten / vorherigen FeldTypen
+
+void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType,
+ USHORT nSubType, BOOL bInReadOnly,
+ BOOL bChkInpFlag = FALSE )
+{
+ // es muss immer der 1. Frame gesucht werden
+ Point aPt;
+ SwTxtFld* pTxtFld;
+ SwClientIter aIter( (SwFieldType&)rFldType );
+ BOOL bSubType = nSubType != USHRT_MAX;
+ for( SwClient* pLast = aIter.First( TYPE( SwFmtFld )); pLast; pLast = aIter.Next() )
+ if( 0 != ( pTxtFld = ((SwFmtFld*)pLast)->GetTxtFld() ) &&
+ ( !bChkInpFlag || ((SwSetExpField*)pTxtFld->GetFld().GetFld())
+ ->GetInputFlag() ) &&
+ (!bSubType || (((SwFmtFld*)pLast)->GetFld()->GetSubType()
+ & 0xff ) == nSubType ))
+ {
+ SwCntntFrm* pCFrm;
+ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+ if( 0 != ( pCFrm = rTxtNode.GetFrm( &aPt, 0, FALSE )) &&
+ ( bInReadOnly || !pCFrm->IsProtected() ))
+ {
+ _SetGetExpFld* pNew = new _SetGetExpFld(
+ SwNodeIndex( rTxtNode ), pTxtFld );
+ pNew->SetBodyPos( *pCFrm );
+ rLst.Insert( pNew );
+ }
+ }
+}
+
+
+FASTBOOL SwCrsrShell::MoveFldType( const SwFieldType* pFldType, BOOL bNext,
+ USHORT nSubType, USHORT nResType )
+{
+ // sortierte Liste aller Felder
+ _SetGetExpFlds aSrtLst( 64 );
+
+ if (pFldType)
+ {
+ if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
+ return FALSE;
+
+ // Modify-Object gefunden, trage alle Felder ins Array ein
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, IsReadOnlyAvailable() );
+
+ if( RES_INPUTFLD == pFldType->Which() )
+ {
+ // es gibt noch versteckte InputFelder in den SetExp. Feldern
+ const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
+ const USHORT nSize = rFldTypes.Count();
+
+ // Alle Typen abklappern
+ for( USHORT i=0; i < nSize; ++i )
+ if( RES_SETEXPFLD == ( pFldType = rFldTypes[ i ] )->Which() )
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
+ IsReadOnlyAvailable(), TRUE );
+ }
+ }
+ else
+ {
+ const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
+ const USHORT nSize = rFldTypes.Count();
+
+ // Alle Typen abklappern
+ for( USHORT i=0; i < nSize; ++i )
+ if( nResType == ( pFldType = rFldTypes[ i ] )->Which() )
+ ::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
+ IsReadOnlyAvailable() );
+ }
+
+ // keine Felder gefunden?
+ if( !aSrtLst.Count() )
+ return FALSE;
+
+ USHORT nPos;
+ SwCursor* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ {
+ // JP 19.08.98: es muss immer ueber das Feld gesucht werden, damit
+ // auch immer das richtige gefunden wird, wenn welche in
+ // Rahmen stehen, die in einem Absatz verankert sind,
+ // in dem ein Feld steht - siehe auch Bug 55247
+ const SwPosition& rPos = *pCrsr->GetPoint();
+
+ SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+ ASSERT( pTNd, "Wo ist mein CntntNode?" );
+
+ SwTxtFld* pTxtFld = (SwTxtFld*)pTNd->GetTxtAttr( rPos.nContent,
+ RES_TXTATR_FIELD );
+ BOOL bDelFld = 0 == pTxtFld;
+ if( bDelFld )
+ {
+ SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
+ (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
+
+ pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() );
+ pTxtFld->ChgTxtNode( pTNd );
+ }
+
+ _SetGetExpFld aSrch( rPos.nNode, pTxtFld, &rPos.nContent );
+ if( rPos.nNode.GetIndex() < pDoc->GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ // auch beim Einsammeln wird nur der erste Frame benutzt!
+ Point aPt;
+ aSrch.SetBodyPos( *pTNd->GetFrm( &aPt, &rPos, FALSE ) );
+ }
+
+ BOOL bFound = aSrtLst.Seek_Entry( &aSrch, &nPos );
+ if( bDelFld )
+ {
+ delete (SwFmtFld*)&pTxtFld->GetAttr();
+ delete pTxtFld;
+ }
+
+ if( bFound ) // stehe auf einem ?
+ {
+ if( bNext )
+ {
+ if( ++nPos >= aSrtLst.Count() )
+ return FALSE; // schon am Ende
+ }
+ else if( !nPos-- )
+ return FALSE; // weiter nach vorne geht nicht
+ }
+ else if( bNext ? nPos >= aSrtLst.Count() : !nPos--)
+ return FALSE;
+ }
+ const _SetGetExpFld& rFnd = **( aSrtLst.GetData() + nPos );
+
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ rFnd.GetPosOfContent( *pCrsr->GetPoint() );
+
+ FASTBOOL bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::GotoFld( const SwFmtFld& rFld )
+{
+ FASTBOOL bRet = FALSE;
+ if( rFld.GetTxtFld() )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ SwCursor* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ SwTxtNode* pTNd = (SwTxtNode*)rFld.GetTxtFld()->GetpTxtNode();
+ pCrsr->GetPoint()->nNode = *pTNd;
+ pCrsr->GetPoint()->nContent.Assign( pTNd, *rFld.GetTxtFld()->GetStart() );
+
+ bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+
+void SwCrsrShell::GotoOutline( USHORT nIdx )
+{
+ SwCursor* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ SwTxtNode* pTxtNd = (SwTxtNode*)rNds.GetOutLineNds()[ nIdx ]->GetTxtNode();
+ pCrsr->GetPoint()->nNode = *pTxtNd;
+ pCrsr->GetPoint()->nContent.Assign( pTxtNd, 0 );
+
+ if( !pCrsr->IsSelOvr() )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+}
+
+
+FASTBOOL SwCrsrShell::GotoOutline( const String& rName )
+{
+ SwCursor* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ FASTBOOL bRet = FALSE;
+ if( pDoc->GotoOutline( *pCrsr->GetPoint(), rName ) && !pCrsr->IsSelOvr() )
+ {
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+
+
+FASTBOOL SwCrsrShell::GotoNextOutline() // naechster Node mit Outline-Num.
+{
+ SwCursor* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ const SwNodes& rNds = GetDoc()->GetNodes();
+
+ SwNode* pNd = pCrsr->GetNode();
+ USHORT nPos;
+ if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
+ ++nPos;
+
+ if( nPos == rNds.GetOutLineNds().Count() )
+ return FALSE;
+
+ pNd = rNds.GetOutLineNds()[ nPos ];
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+ pCrsr->GetPoint()->nNode = *pNd;
+ pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
+
+ FASTBOOL bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::GotoPrevOutline() // vorheriger Node mit Outline-Num.
+{
+ SwCursor* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ const SwNodes& rNds = GetDoc()->GetNodes();
+
+ SwNode* pNd = pCrsr->GetNode();
+ USHORT nPos;
+ rNds.GetOutLineNds().Seek_Entry( pNd, &nPos );
+
+ FASTBOOL bRet = FALSE;
+ if( nPos )
+ {
+ --nPos; // davor
+
+ pNd = rNds.GetOutLineNds()[ nPos ];
+ if( pNd->GetIndex() > pCrsr->GetPoint()->nNode.GetIndex() )
+ return FALSE;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+ pCrsr->GetPoint()->nNode = *pNd;
+ pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)pNd, 0 );
+
+ bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+
+ // suche die "Outline-Position" vom vorherigen Outline-Node mit dem
+ // Level.
+USHORT SwCrsrShell::GetOutlinePos( BYTE nLevel )
+{
+ SwPaM* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+ const SwNodes& rNds = GetDoc()->GetNodes();
+
+ SwNode* pNd = pCrsr->GetNode();
+ USHORT nPos;
+ if( rNds.GetOutLineNds().Seek_Entry( pNd, &nPos ))
+ nPos++; // steht auf der Position, fuers while zum Naechsten
+
+ while( nPos-- ) // immer den davor testen !
+ {
+ pNd = rNds.GetOutLineNds()[ nPos ];
+ if( ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() <= nLevel )
+ return nPos;
+ }
+ return USHRT_MAX; // davor keiner mehr also Ende
+}
+
+
+FASTBOOL SwCrsrShell::MakeOutlineSel( USHORT nSttPos, USHORT nEndPos,
+ BOOL bWithChilds )
+{
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+ if( !rOutlNds.Count() ) // wie jetzt ???
+ return FALSE;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+
+ if( nSttPos > nEndPos ) // sollte jemand das vertauscht haben?
+ {
+ ASSERT( !this, "Start- > Ende-Position im Array" );
+ USHORT nTmp = nSttPos;
+ nSttPos = nEndPos;
+ nEndPos = nTmp;
+ }
+
+ SwNode* pSttNd = rOutlNds[ nSttPos ];
+ SwNode* pEndNd = rOutlNds[ nEndPos ];
+
+ if( bWithChilds )
+ {
+ BYTE nLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();
+ for( ++nEndPos; nEndPos < rOutlNds.Count(); ++nEndPos )
+ {
+ pEndNd = rOutlNds[ nEndPos ];
+ BYTE nNxtLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();
+ if( nNxtLevel <= nLevel )
+ break; // EndPos steht jetzt auf dem naechsten
+ }
+ }
+ // ohne Childs, dann aber zumindest auf den naechsten
+ else if( ++nEndPos < rOutlNds.Count() )
+ pEndNd = rOutlNds[ nEndPos ];
+
+ if( nEndPos == rOutlNds.Count() ) // kein Ende gefunden
+ pEndNd = &rNds.GetEndOfContent();
+
+ KillPams();
+
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ // Jetzt das Ende ans Ende vom voherigen ContentNode setzen
+ pCurCrsr->GetPoint()->nNode = *pSttNd;
+ pCurCrsr->GetPoint()->nContent.Assign( pSttNd->GetCntntNode(), 0 );
+ pCurCrsr->SetMark();
+ pCurCrsr->GetPoint()->nNode = *pEndNd;
+ pCurCrsr->Move( fnMoveBackward, fnGoNode ); // ans Ende vom Vorgaenger
+
+ // und schon ist alles selektiert
+ FASTBOOL bRet = !pCurCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return bRet;
+}
+
+
+// springe zu dieser Refmark
+FASTBOOL SwCrsrShell::GotoRefMark( const String& rRefMark, USHORT nSubType,
+ USHORT nSeqNo )
+{
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ USHORT nPos;
+ SwTxtNode* pTxtNd = SwGetRefFieldType::FindAnchor( GetDoc(), rRefMark,
+ nSubType, nSeqNo, &nPos );
+ if( pTxtNd )
+ {
+ pCurCrsr->GetPoint()->nNode = *pTxtNd;
+ pCurCrsr->GetPoint()->nContent.Assign( pTxtNd, nPos );
+
+ if( !pCurCrsr->IsSelOvr() )
+ {
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+FASTBOOL SwCrsrShell::GetContentAtPos( const Point& rPt,
+ SwContentAtPos& rCntntAtPos,
+ FASTBOOL bSetCrsr,
+ SwRect* pFldRect )
+{
+ SET_CURR_SHELL( this );
+ FASTBOOL bRet = FALSE;
+
+ if( !IsTableMode() )
+ {
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+
+ SwTxtNode* pTxtNd;
+ SwCntntFrm *pFrm;
+ SwTxtAttr* pTxtAttr;
+ SwCrsrMoveState aTmpState;
+ aTmpState.bFieldInfo = TRUE;
+ aTmpState.bExactOnly = !( SwContentAtPos::SW_OUTLINE &
+ rCntntAtPos.eCntntAtPos );
+ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+
+ BOOL bCrsrFoundExact = GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
+ pTxtNd = aPos.nNode.GetNode().GetTxtNode();
+
+ const SwNodes& rNds = GetDoc()->GetNodes();
+ if( pTxtNd && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
+ && rNds.GetOutLineNds().Count() )
+ {
+ const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
+ if( pONd )
+ {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_OUTLINE;
+ rCntntAtPos.sStr = pONd->GetExpandTxt( 0, STRING_LEN, TRUE );
+ bRet = TRUE;
+ }
+ }
+ else if( bCrsrFoundExact && pTxtNd )
+ {
+ if( !aTmpState.bPosCorr )
+ {
+ if( ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD )
+ & rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
+ {
+ pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent.GetIndex(),
+ RES_TXTATR_FIELD );
+ const SwField* pFld = pTxtAttr
+ ? pTxtAttr->GetFld().GetFld()
+ : 0;
+ if( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos &&
+ pFld && !pFld->HasClickHdl() )
+ pFld = 0;
+
+ if( pFld )
+ {
+ if( pFldRect && 0 != ( pFrm = pTxtNd->GetFrm( &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr() )
+ {
+ // Click-Felder in geschuetzten Bereichen zulassen
+ // Nur Platzhalter geht nicht!
+ if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
+ || RES_JUMPEDITFLD == pFld->Which() )
+ pFld = 0;
+ }
+ else
+ UpdateCrsr();
+ }
+ else if( RES_TABLEFLD == pFld->Which() &&
+ ((SwTblField*)pFld)->IsIntrnlName() )
+ {
+ // erzeuge aus der internen (fuer CORE)
+ // die externe (fuer UI) Formel
+ const SwTableNode* pTblNd = pTxtNd->FindTableNode();
+ if( pTblNd ) // steht in einer Tabelle
+ ((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() );
+ }
+ }
+
+ if( pFld )
+ {
+ rCntntAtPos.aFnd.pFld = pFld;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FIELD;
+ bRet = TRUE;
+ }
+ }
+
+ if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
+ {
+ if( aTmpState.bFtnNoInfo )
+ {
+ // stehe ueber dem Zeichen der Fussnote (??)
+ bRet = TRUE;
+ if( bSetCrsr )
+ {
+ *pCurCrsr->GetPoint() = aPos;
+ if( !GotoFtnAnchor() )
+ bRet = FALSE;
+ }
+ if( bRet )
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
+ }
+ else if( 0 != ( pTxtAttr = pTxtNd->GetTxtAttr(
+ aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
+ {
+ bRet = TRUE;
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
+ SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
+ &pCurCrsr->GetPoint()->nNode,
+ TRUE, !IsReadOnlyAvailable() );
+
+ if( pCNd )
+ {
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+ if( pCurCrsr->IsSelOvr( SELOVER_CHECKNODESSECTION |
+ SELOVER_TOGGLE ))
+ bRet = FALSE;
+ else
+ UpdateCrsr();
+ }
+ else
+ bRet = FALSE;
+ }
+
+ if( bRet )
+ {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+ rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->GetFrm( &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && ( SwContentAtPos::SW_TOXMARK |
+ SwContentAtPos::SW_REFMARK ) &
+ rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
+ {
+ pTxtAttr = 0;
+ if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
+ pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent,
+ RES_TXTATR_TOXMARK );
+
+ if( !pTxtAttr &&
+ SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
+ pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent,
+ RES_TXTATR_REFMARK );
+
+ if( pTxtAttr )
+ {
+ bRet = TRUE;
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr( SELOVER_CHECKNODESSECTION | SELOVER_TOGGLE ) )
+ bRet = FALSE;
+ else
+ UpdateCrsr();
+ }
+
+ if( bRet )
+ {
+ const xub_StrLen* pEnd = pTxtAttr->GetEnd();
+ if( pEnd )
+ rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
+ *pTxtAttr->GetStart(),
+ *pEnd - *pTxtAttr->GetStart(),
+ FALSE );
+ else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
+ rCntntAtPos.sStr = pTxtAttr->GetTOXMark().
+ GetAlternativeText();
+
+ rCntntAtPos.eCntntAtPos =
+ RES_TXTATR_TOXMARK == pTxtAttr->Which()
+ ? SwContentAtPos::SW_TOXMARK
+ : SwContentAtPos::SW_REFMARK;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+ rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->GetFrm( &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
+ && !aTmpState.bFtnNoInfo )
+ {
+ pTxtAttr = pTxtNd->GetTxtAttr( aPos.nContent,
+ RES_TXTATR_INETFMT );
+ // nur INetAttrs mit URLs "erkennen"
+ if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() )
+ {
+ bRet = TRUE;
+ if( bSetCrsr )
+ {
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ pCurCrsr->DeleteMark();
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr(SELOVER_CHECKNODESSECTION | SELOVER_TOGGLE) )
+ bRet = FALSE;
+ else
+ UpdateCrsr();
+ }
+ if( bRet )
+ {
+ rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
+ *pTxtAttr->GetStart(),
+ *pTxtAttr->GetEnd() - *pTxtAttr->GetStart(),
+ FALSE );
+
+ rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
+ rCntntAtPos.pFndTxtAttr = pTxtAttr;
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->GetFrm( &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
+ {
+ const SwRedline* pRedl = GetDoc()->GetRedline( aPos );
+ if( pRedl )
+ {
+ rCntntAtPos.aFnd.pRedl = pRedl;
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
+ rCntntAtPos.pFndTxtAttr = 0;
+ bRet = TRUE;
+
+ if( pFldRect && 0 != ( pFrm = pTxtNd->GetFrm( &aPt ) ) )
+ pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+ }
+ }
+ }
+
+ if( !bRet && (
+ SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
+#ifndef PRODUCT
+ || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
+#endif
+ ))
+ {
+ const SwTableNode* pTblNd;
+ const SwTableBox* pBox;
+ const SwStartNode* pSttNd = pTxtNd->FindTableBoxStartNode();
+ const SfxPoolItem* pItem;
+ if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
+ 0 != ( pBox = pTblNd->GetTable().GetTblBox(
+ pSttNd->GetIndex() )) &&
+#ifndef PRODUCT
+ ( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+ RES_BOXATR_FORMULA, FALSE, &pItem ) ||
+ SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+ RES_BOXATR_VALUE, FALSE, &pItem ))
+#else
+ SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+ RES_BOXATR_FORMULA, FALSE, &pItem )
+#endif
+ )
+ {
+ SwFrm* pF = pTxtNd->GetFrm( &aPt );
+ if( pF )
+ {
+ // dann aber den CellFrame
+ pFrm = (SwCntntFrm*)pF;
+ while( pF && !pF->IsCellFrm() )
+ pF = pF->GetUpper();
+ }
+
+ // es wurde ein
+ if( aTmpState.bPosCorr )
+ {
+ if( pF && !pF->Frm().IsInside( aPt ))
+ pF = 0;
+ }
+ else if( !pF )
+ pF = pFrm;
+
+ if( pF ) // nur dann ist es gueltig!!
+ {
+ // erzeuge aus der internen (fuer CORE)
+ // die externe (fuer UI) Formel
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML;
+#ifndef PRODUCT
+ if( RES_BOXATR_VALUE == pItem->Which() )
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
+ else
+#endif
+ ((SwTblBoxFormula*)pItem)->PtrToBoxNm( &pTblNd->GetTable() );
+
+ bRet = TRUE;
+ if( bSetCrsr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+ *pCurCrsr->GetPoint() = aPos;
+ if( pCurCrsr->IsSelOvr( SELOVER_CHECKNODESSECTION | SELOVER_TOGGLE) )
+ bRet = FALSE;
+ else
+ UpdateCrsr();
+ }
+
+ if( bRet )
+ {
+ if( pFldRect )
+ {
+ *pFldRect = pF->Prt();
+ *pFldRect += pF->Frm().Pos();
+ }
+ rCntntAtPos.pFndTxtAttr = 0;
+ rCntntAtPos.aFnd.pAttr = pItem;
+ }
+ }
+ }
+ }
+
+#ifndef PRODUCT
+ if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos )
+ {
+ xub_StrLen n = aPos.nContent.GetIndex();
+ SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
+ POOLATTR_END - 1 );
+ if( pTxtNd->GetpSwpHints() )
+ {
+ for( USHORT i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
+ {
+ const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i];
+ xub_StrLen nAttrStart = *pHt->GetStart();
+ if( nAttrStart > n ) // ueber den Bereich hinaus
+ break;
+
+ if( 0 != pHt->GetEnd() && (
+ ( nAttrStart < n &&
+ ( pHt->DontExpand() ? n < *pHt->GetEnd()
+ : n <= *pHt->GetEnd() )) ||
+ ( n == nAttrStart &&
+ ( nAttrStart == *pHt->GetEnd() || !n ))) )
+ {
+ aSet.Put( pHt->GetAttr() );
+ }
+ }
+ if( pTxtNd->GetpSwAttrSet() &&
+ pTxtNd->GetSwAttrSet().Count() )
+ {
+ SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() );
+ // aus dem Format-Set alle entfernen, die im TextSet auch gesetzt sind
+ aFmtSet.Differentiate( aSet );
+ // jetzt alle zusammen "mergen"
+ aSet.Put( aFmtSet );
+ }
+ }
+ else
+ pTxtNd->SwCntntNode::GetAttr( aSet );
+
+ rCntntAtPos.sStr.AssignAscii(
+ RTL_CONSTASCII_STRINGPARAM( "Pos: (" ));
+ rCntntAtPos.sStr += String::CreateFromInt32( aPos.nNode.GetIndex());
+ rCntntAtPos.sStr += ':';
+ rCntntAtPos.sStr += String::CreateFromInt32( aPos.nContent.GetIndex());
+ rCntntAtPos.sStr += ')';
+ rCntntAtPos.sStr.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " ));
+ rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName();
+ if( pTxtNd->GetCondFmtColl() )
+ rCntntAtPos.sStr.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " ))
+ += pTxtNd->GetCondFmtColl()->GetName();
+
+ if( aSet.Count() )
+ {
+ String sAttrs;
+ SfxItemIter aIter( aSet );
+ const SfxPoolItem* pItem = aIter.FirstItem();
+ while( TRUE )
+ {
+ if( !IsInvalidItem( pItem ))
+ {
+ String aStr;
+ GetDoc()->GetAttrPool().GetPresentation( *pItem,
+ SFX_ITEM_PRESENTATION_COMPLETE,
+ SFX_MAPUNIT_CM, aStr );
+ if( sAttrs.Len() )
+ sAttrs.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( ", " ));
+ sAttrs += aStr;
+ }
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ if( sAttrs.Len() )
+ {
+ if( rCntntAtPos.sStr.Len() )
+ rCntntAtPos.sStr += '\n';
+ rCntntAtPos.sStr.AppendAscii(
+ RTL_CONSTASCII_STRINGPARAM( "Attr: " ) )
+ += sAttrs;
+ }
+ }
+ bRet = TRUE;
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_CURR_ATTRS;
+ }
+#endif
+ }
+ }
+
+ if( !bRet )
+ {
+ rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_NOTHING;
+ rCntntAtPos.aFnd.pFld = 0;
+ }
+ return bRet;
+}
+
+// befindet sich der Node in einem geschuetzten Bereich?
+FASTBOOL SwContentAtPos::IsInProtectSect() const
+{
+ const SwTxtNode* pNd = 0;
+ if( pFndTxtAttr )
+ {
+ switch( eCntntAtPos )
+ {
+ case SW_FIELD:
+ case SW_CLICKFIELD:
+ pNd = ((SwTxtFld*)pFndTxtAttr)->GetpTxtNode();
+ break;
+
+ case SW_FTN:
+ pNd = &((SwTxtFtn*)pFndTxtAttr)->GetTxtNode();
+ break;
+
+ case SW_INETATTR:
+ pNd = ((SwTxtINetFmt*)pFndTxtAttr)->GetpTxtNode();
+ break;
+ }
+ }
+
+ const SwCntntFrm* pFrm;
+ return pNd && ( pNd->IsInProtectSect() ||
+ ( 0 != ( pFrm = pNd->GetFrm(0,0,FALSE)) &&
+ pFrm->IsProtected() ));
+}
+
+FASTBOOL SwCrsrShell::SelectTxtAttr( USHORT nWhich, BOOL bExpand,
+ const SwTxtAttr* pTxtAttr )
+{
+ SET_CURR_SHELL( this );
+ FASTBOOL bRet = FALSE;
+
+ if( !IsTableMode() )
+ {
+ SwPosition& rPos = *pCurCrsr->GetPoint();
+ if( !pTxtAttr )
+ {
+ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+ pTxtAttr = pTxtNd ? pTxtNd->GetTxtAttr( rPos.nContent,
+ nWhich, bExpand ) : 0;
+ }
+
+ if( pTxtAttr )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pCurCrsr->DeleteMark();
+ rPos.nContent = *pTxtAttr->GetStart();
+ pCurCrsr->SetMark();
+ const xub_StrLen* pEnd = pTxtAttr->GetEnd();
+ rPos.nContent = pEnd ? *pEnd : *pTxtAttr->GetStart() + 1;
+
+ if( !pCurCrsr->IsSelOvr() )
+ {
+ UpdateCrsr();
+ bRet = TRUE;
+ }
+ }
+ }
+ return bRet;
+}
+
+
+FASTBOOL SwCrsrShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
+{
+ FASTBOOL bRet = FALSE;
+ if( rAttr.GetpTxtNode() )
+ {
+ SwCursor* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCrsr );
+
+ pCrsr->GetPoint()->nNode = *rAttr.GetpTxtNode();
+ pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)rAttr.GetpTxtNode(),
+ *rAttr.GetStart() );
+ bRet = !pCrsr->IsSelOvr();
+ if( bRet )
+ UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ }
+ return bRet;
+}
+
+
+const SwFmtINetFmt* SwCrsrShell::FindINetAttr( const String& rName ) const
+{
+ return pDoc->FindINetAttr( rName );
+}
+
+FASTBOOL SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
+ SwRect& rRect, SwHoriOrient& rOrient )
+{
+
+ SET_CURR_SHELL( this );
+ FASTBOOL bRet = FALSE;
+
+ if( !IsTableMode() && !HasSelection() && GetDoc()->DoesUndo() )
+ {
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+
+ SwFillCrsrPos aFPos( eFillMode );
+ SwCrsrMoveState aTmpState( &aFPos );
+
+ if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) &&
+ !aPos.nNode.GetNode().IsProtect())
+ {
+ // Start-Position im geschuetzten Bereich?
+ rRect = aFPos.aCrsr;
+ rOrient = aFPos.eOrient;
+ bRet = TRUE;
+ }
+ }
+ return bRet;
+}
+
+FASTBOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
+{
+ SET_CURR_SHELL( this );
+ FASTBOOL bRet = FALSE;
+
+ if( !IsTableMode() && !HasSelection() && GetDoc()->DoesUndo() )
+ {
+ Point aPt( rPt );
+ SwPosition aPos( *pCurCrsr->GetPoint() );
+
+ SwFillCrsrPos aFPos( eFillMode );
+ SwCrsrMoveState aTmpState( &aFPos );
+
+ if( GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState ) )
+ {
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen
+ StartAction();
+
+ SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
+ USHORT nUndoId = UNDO_INS_FROM_SHADOWCRSR;
+ // Werden nur die Absatzattribute Adjust oder LRSpace gesetzt,
+ // dann sollte der naechste Aufruf die NICHT wieder entfernen.
+ if( 0 == aFPos.nParaCnt + aFPos.nColumnCnt &&
+ ( FILL_INDENT == aFPos.eMode ||
+ ( HORI_NONE != aFPos.eOrient &&
+ 0 == aFPos.nTabCnt + aFPos.nSpaceCnt )) &&
+ pCNd && pCNd->Len() )
+ nUndoId = 0;
+
+ GetDoc()->StartUndo( nUndoId );
+
+ SwTxtFmtColl* pNextFmt = 0;
+ SwTxtNode* pTNd = pCNd->GetTxtNode();
+ if( pTNd )
+ pNextFmt = &pTNd->GetTxtColl()->GetNextTxtFmtColl();
+
+ const SwSectionNode* pSectNd = pCNd->FindSectionNode();
+ if( pSectNd && aFPos.nParaCnt )
+ {
+ SwNodeIndex aEnd( aPos.nNode, 1 );
+ while( aEnd.GetNode().IsEndNode() &&
+ (const SwNode*)&aEnd.GetNode() !=
+ pSectNd->EndOfSectionNode() )
+ aEnd++;
+
+ if( aEnd.GetNode().IsEndNode() &&
+ pCNd->Len() == aPos.nContent.GetIndex() )
+ aPos.nNode = *pSectNd->EndOfSectionNode();
+ }
+
+ for( USHORT n = 0; n < aFPos.nParaCnt + aFPos.nColumnCnt; ++n )
+ {
+ GetDoc()->AppendTxtNode( aPos );
+ if( !n && pNextFmt )
+ {
+ *pCurCrsr->GetPoint() = aPos;
+ GetDoc()->SetTxtFmtColl( *pCurCrsr, pNextFmt, FALSE );
+ //JP 04.11.97: erstmal keine Folgevorlage der
+ // Folgevorlage beachten
+ // pNextFmt = pNextFmt->GetNextTxtFmtColl();
+ }
+ if( n < aFPos.nColumnCnt )
+ {
+ *pCurCrsr->GetPoint() = aPos;
+ GetDoc()->Insert( *pCurCrsr,
+ SvxFmtBreakItem( SVX_BREAK_COLUMN_BEFORE ));
+ }
+ }
+
+ *pCurCrsr->GetPoint() = aPos;
+ switch( aFPos.eMode )
+ {
+ case FILL_INDENT:
+ if( 0 != (pCNd = aPos.nNode.GetNode().GetCntntNode() ))
+ {
+ SfxItemSet aSet( GetDoc()->GetAttrPool(),
+ RES_LR_SPACE, RES_LR_SPACE,
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+ 0 );
+ SvxLRSpaceItem aLR( (SvxLRSpaceItem&)
+ pCNd->GetAttr( RES_LR_SPACE ) );
+ aLR.SetTxtLeft( aFPos.nTabCnt );
+ aLR.SetTxtFirstLineOfst( 0 );
+ aSet.Put( aLR );
+
+ const SvxAdjustItem& rAdj = (SvxAdjustItem&)pCNd->
+ GetAttr( RES_PARATR_ADJUST );
+ if( SVX_ADJUST_LEFT != rAdj.GetAdjust() )
+ aSet.Put( SvxAdjustItem( SVX_ADJUST_LEFT ) );
+
+ GetDoc()->Insert( *pCurCrsr, aSet );
+ }
+ else
+ ASSERT( !this, "wo ist mein CntntNode?" );
+ break;
+
+ case FILL_TAB:
+ case FILL_SPACE:
+ {
+ String sInsert;
+ if( aFPos.nTabCnt )
+ sInsert.Fill( aFPos.nTabCnt, '\t' );
+ if( aFPos.nSpaceCnt )
+ {
+ String sSpace;
+ sSpace.Fill( aFPos.nSpaceCnt );
+ sInsert += sSpace;
+ }
+ if( sInsert.Len() )
+ GetDoc()->Insert( *pCurCrsr, sInsert );
+ }
+ // kein break - Ausrichtung muss noch gesetzt werden
+ case FILL_MARGIN:
+ if( HORI_NONE != aFPos.eOrient )
+ {
+ SvxAdjustItem aAdj( SVX_ADJUST_LEFT );
+ switch( aFPos.eOrient )
+ {
+ case HORI_CENTER:
+ aAdj.SetAdjust( SVX_ADJUST_CENTER );
+ break;
+ case HORI_RIGHT:
+ aAdj.SetAdjust( SVX_ADJUST_RIGHT );
+ break;
+ }
+ GetDoc()->Insert( *pCurCrsr, aAdj );
+ }
+ break;
+ }
+
+ GetDoc()->EndUndo( nUndoId );
+ EndAction();
+
+ bRet = TRUE;
+ }
+ }
+ return bRet;
+}
+
+const SwRedline* SwCrsrShell::SelNextRedline()
+{
+ const SwRedline* pFnd = 0;
+ if( !IsTableMode() )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pFnd = GetDoc()->SelNextRedline( *pCurCrsr );
+ if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ else
+ pFnd = 0;
+ }
+ return pFnd;
+}
+
+const SwRedline* SwCrsrShell::SelPrevRedline()
+{
+ const SwRedline* pFnd = 0;
+ if( !IsTableMode() )
+ {
+ SET_CURR_SHELL( this );
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pFnd = GetDoc()->SelPrevRedline( *pCurCrsr );
+ if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY);
+ else
+ pFnd = 0;
+ }
+ return pFnd;
+}
+
+const SwRedline* SwCrsrShell::_GotoRedline( USHORT nArrPos, BOOL bSelect )
+{
+ const SwRedline* pFnd = 0;
+ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen, evt. Link callen
+ SwCrsrSaveState aSaveState( *pCurCrsr );
+
+ pFnd = GetDoc()->GetRedlineTbl()[ nArrPos ];
+ if( pFnd )
+ {
+ *pCurCrsr->GetPoint() = *pFnd->Start();
+
+ SwCntntNode* pCNd;
+ SwNodeIndex* pIdx = &pCurCrsr->GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetDoc()->GetNodes().GoNextSection( pIdx,
+ TRUE, IsReadOnlyAvailable() )) )
+ {
+ if( *pIdx <= pFnd->End()->nNode )
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+ else
+ pFnd = 0;
+ }
+
+ if( pFnd && bSelect )
+ {
+ pCurCrsr->SetMark();
+ if( REDLINE_FMTCOLL == pFnd->GetType() )
+ {
+ pCNd = pIdx->GetNode().GetCntntNode();
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ pCurCrsr->GetMark()->nContent.Assign( pCNd, 0 );
+ }
+ else
+ *pCurCrsr->GetPoint() = *pFnd->End();
+
+ pIdx = &pCurCrsr->GetPoint()->nNode;
+ if( !pIdx->GetNode().IsCntntNode() &&
+ 0 != ( pCNd = GetDoc()->GetNodes().GoPrevSection( pIdx,
+ TRUE, IsReadOnlyAvailable() )) )
+ {
+ if( *pIdx >= pCurCrsr->GetMark()->nNode )
+ pCurCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ else
+ pFnd = 0;
+ }
+ }
+
+ if( !pFnd )
+ {
+ pCurCrsr->DeleteMark();
+ pCurCrsr->RestoreSavePos();
+ }
+ else if( bSelect && *pCurCrsr->GetMark() == *pCurCrsr->GetPoint() )
+ pCurCrsr->DeleteMark();
+
+ if( pFnd && !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
+ UpdateCrsr( SwCrsrShell::SCROLLWIN | SwCrsrShell::CHKRANGE
+ | SwCrsrShell::READONLY );
+ else
+ {
+ pFnd = 0;
+ if( bSelect )
+ pCurCrsr->DeleteMark();
+ }
+ }
+ return pFnd;
+}
+
+const SwRedline* SwCrsrShell::GotoRedline( USHORT nArrPos, BOOL bSelect )
+{
+ const SwRedline* pFnd = 0;
+ if( !IsTableMode() )
+ {
+ SET_CURR_SHELL( this );
+
+ const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+ const SwRedline* pTmp = rTbl[ nArrPos ];
+ USHORT nSeqNo = pTmp->GetSeqNo();
+ if( nSeqNo && bSelect )
+ {
+ BOOL bCheck = FALSE;
+ int nLoopCnt = 2;
+ USHORT nArrSavPos = nArrPos;
+
+ do {
+ pTmp = _GotoRedline( nArrPos, TRUE );
+
+ if( !pFnd )
+ pFnd = pTmp;
+
+ if( pTmp && bCheck )
+ {
+ // checke auf Ueberlappungen. Das kann durch
+ // FmtColl-Redlines kommen, die auf den gesamten Absatz
+ // aus gedehnt werden.
+
+ SwPaM* pCur = pCurCrsr, *pNext = (SwPaM*)pCur->GetNext();
+ SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
+ while( pCur != pNext )
+ {
+ const SwPosition *pNStt = pNext->Start(),
+ *pNEnd = pNext->End();
+
+ BOOL bDel = TRUE;
+ switch( ::ComparePosition( *pCStt, *pCEnd,
+ *pNStt, *pNEnd ))
+ {
+ case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2
+ if( !pCur->HasMark() )
+ {
+ pCur->SetMark();
+ *pCur->GetMark() = *pNStt;
+ }
+ else
+ *pCStt = *pNStt;
+ *pCEnd = *pNEnd;
+ break;
+
+ case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1
+ case POS_EQUAL: // Pos1 ist genauso gross wie Pos2
+ break;
+
+ case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang
+ if( !pCur->HasMark() )
+ pCur->SetMark();
+ *pCEnd = *pNEnd;
+ break;
+ case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende
+ if( !pCur->HasMark() )
+ {
+ pCur->SetMark();
+ *pCur->GetMark() = *pNStt;
+ }
+ else
+ *pCStt = *pNStt;
+ break;
+
+ default:
+ bDel = FALSE;
+ }
+
+ if( bDel )
+ {
+ // den brauchen wir nicht mehr
+ SwPaM* pPrev = (SwPaM*)pNext->GetPrev();
+ delete pNext;
+ pNext = pPrev;
+ }
+ pNext = (SwPaM*)pNext->GetNext();
+ }
+ }
+
+ USHORT nFndPos = 2 == nLoopCnt
+ ? rTbl.FindNextOfSeqNo( nArrPos )
+ : rTbl.FindPrevOfSeqNo( nArrPos );
+ if( USHRT_MAX != nFndPos ||
+ ( 0 != ( --nLoopCnt ) && USHRT_MAX != (
+ nFndPos = rTbl.FindPrevOfSeqNo( nArrSavPos ))) )
+ {
+ if( pTmp )
+ {
+ // neuen Cursor erzeugen
+ CreateCrsr();
+ bCheck = TRUE;
+ }
+ nArrPos = nFndPos;
+ }
+ else
+ nLoopCnt = 0;
+
+ } while( nLoopCnt );
+ }
+ else
+ pFnd = _GotoRedline( nArrPos, bSelect );
+ }
+ return pFnd;
+}
+
+
+
diff --git a/sw/source/core/crsr/crstrvl1.cxx b/sw/source/core/crsr/crstrvl1.cxx
new file mode 100644
index 000000000000..4dac2c4374c3
--- /dev/null
+++ b/sw/source/core/crsr/crstrvl1.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: crstrvl1.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 _CRSRSH_HXX
+#include <crsrsh.hxx>
+#endif
+#ifndef _VISCRS_HXX
+#include <viscrs.hxx>
+#endif
+#ifndef _CALLNK_HXX
+#include <callnk.hxx>
+#endif
+
+FASTBOOL SwCrsrShell::IsStartWord() const
+{
+ return pCurCrsr->IsStartWord();
+}
+FASTBOOL SwCrsrShell::IsEndWord() const
+{
+ return pCurCrsr->IsEndWord();
+}
+FASTBOOL SwCrsrShell::IsInWord() const
+{
+ return pCurCrsr->IsInWord();
+}
+
+
+FASTBOOL SwCrsrShell::GoStartWord()
+{
+ return CallCrsrFN( &SwCursor::GoStartWord );
+}
+FASTBOOL SwCrsrShell::GoEndWord()
+{
+ return CallCrsrFN( &SwCursor::GoEndWord );
+}
+FASTBOOL SwCrsrShell::GoNextWord()
+{
+ return CallCrsrFN( &SwCursor::GoNextWord );
+}
+FASTBOOL SwCrsrShell::GoPrevWord()
+{
+ return CallCrsrFN( &SwCursor::GoPrevWord );
+}
+FASTBOOL SwCrsrShell::GoNextSentence()
+{
+ return CallCrsrFN( &SwCursor::GoNextSentence );
+}
+FASTBOOL SwCrsrShell::GoPrevSentence()
+{
+ return CallCrsrFN( &SwCursor::GoPrevSentence );
+}
+
+FASTBOOL SwCrsrShell::SelectWord( const Point* pPt )
+{
+ return pCurCrsr->SelectWord( pPt );
+}
+
+
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
new file mode 100644
index 000000000000..34e65905851c
--- /dev/null
+++ b/sw/source/core/crsr/findattr.cxx
@@ -0,0 +1,1463 @@
+/*************************************************************************
+ *
+ * $RCSfile: findattr.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 <hintids.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX //autogen wg. Application
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SFXITEMITER_HXX //autogen
+#include <svtools/itemiter.hxx>
+#endif
+#ifndef _SFX_WHITER_HXX //autogen
+#include <svtools/whiter.hxx>
+#endif
+
+#ifndef _SVX_BRKITEM_HXX //autogen
+#include <svx/brkitem.hxx>
+#endif
+#ifndef _SVX_COLRITEM_HXX //autogen
+#include <svx/colritem.hxx>
+#endif
+#ifndef _SVX_FONTITEM_HXX //autogen
+#include <svx/fontitem.hxx>
+#endif
+#ifndef _FMTPDSC_HXX //autogen
+#include <fmtpdsc.hxx>
+#endif
+#ifndef _TXATBASE_HXX //autogen
+#include <txatbase.hxx>
+#endif
+#ifndef _FCHRFMT_HXX //autogen
+#include <fchrfmt.hxx>
+#endif
+#ifndef _CHARFMT_HXX //autogen
+#include <charfmt.hxx>
+#endif
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _SWCRSR_HXX
+#include <swcrsr.hxx>
+#endif
+#ifndef _EDITSH_HXX
+#include <editsh.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _PAMTYP_HXX
+#include <pamtyp.hxx>
+#endif
+#ifndef _SWUNDO_HXX
+#include <swundo.hxx>
+#endif
+
+
+
+SV_DECL_PTRARR_SORT( SwpFmts, SwFmt*, 0, 4 )
+SV_IMPL_PTRARR_SORT( SwpFmts, SwFmt* )
+
+ // Sonderbehandlung fuer SvxFontItem, nur den Namen vergleichen:
+int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 )
+{
+ switch( rItem1.Which() )
+ {
+ case RES_CHRATR_FONT:
+ return ((SvxFontItem&)rItem1).GetFamilyName() ==
+ ((SvxFontItem&)rItem2).GetFamilyName();
+
+ case RES_CHRATR_COLOR:
+ return ((SvxColorItem&)rItem1).GetValue().IsRGBEqual(
+ ((SvxColorItem&)rItem2).GetValue() );
+ case RES_PAGEDESC:
+ return ((SwFmtPageDesc&)rItem1).GetNumOffset() ==
+ ((SwFmtPageDesc&)rItem2).GetNumOffset() &&
+ ((SwFmtPageDesc&)rItem1).GetPageDesc() ==
+ ((SwFmtPageDesc&)rItem2).GetPageDesc();
+ }
+ return rItem1 == rItem2;
+}
+
+
+const SwTxtAttr* GetFrwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos,
+ xub_StrLen nCntntPos )
+{
+ while( rPos < rHtsArr.Count() )
+ {
+ const SwTxtAttr *pTxtHt = rHtsArr.GetStart( rPos++ );
+ // der Start vom Attribut muss innerhalb des Bereiches liegen !!
+ if( *pTxtHt->GetStart() >= nCntntPos )
+ return pTxtHt; // gueltiges TextAttribut
+ }
+ return 0; // kein gueltiges TextAttribut
+}
+
+
+const SwTxtAttr* GetBkwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos,
+ xub_StrLen nCntntPos )
+{
+ while( rPos > 0 )
+ {
+ //Hack mit cast fuer das Update
+ const SwTxtAttr *pTxtHt = rHtsArr.GetStart( --rPos );
+ // der Start vom Attribut muss innerhalb des Bereiches liegen !!
+ if( *pTxtHt->GetStart() < nCntntPos )
+ return pTxtHt; // gueltiges TextAttribut
+ }
+ return 0; // kein gueltiges TextAttribut
+}
+
+
+void lcl_SetAttrPam( SwPaM & rPam, xub_StrLen nStart, const xub_StrLen* pEnde,
+ const BOOL bSaveMark )
+{
+ xub_StrLen nCntntPos;
+ if( bSaveMark )
+ nCntntPos = rPam.GetMark()->nContent.GetIndex();
+ else
+ nCntntPos = rPam.GetPoint()->nContent.GetIndex();
+ FASTBOOL bTstEnde = rPam.GetPoint()->nNode == rPam.GetMark()->nNode;
+
+ SwCntntNode* pCNd = rPam.GetCntntNode();
+ rPam.GetPoint()->nContent.Assign( pCNd, nStart );
+ rPam.SetMark(); // Point == GetMark
+
+ // Point zeigt auf das Ende vom SuchBereich oder Ende vom Attribut
+ if( pEnde )
+ {
+ if( bTstEnde && *pEnde > nCntntPos )
+ rPam.GetPoint()->nContent = nCntntPos;
+ else
+ rPam.GetPoint()->nContent = *pEnde;
+ }
+}
+
+//------------------ Suche nach einem Text Attribut -----------------------
+
+// diese Funktion sucht in einem TextNode nach dem vorgegebenen Attribut.
+// Wird es gefunden, dann hat der SwPaM den Bereich der das Attribut
+// umspannt, unter Beachtung des Suchbereiches
+
+
+FASTBOOL lcl_Search( const SwTxtNode& rTxtNd, SwPaM& rPam,
+ const SfxPoolItem& rCmpItem,
+ SwMoveFn fnMove, BOOL bValue )
+{
+ if ( !rTxtNd.HasHints() )
+ return FALSE;
+ const SwTxtAttr *pTxtHt = 0;
+ FASTBOOL bForward = fnMove == fnMoveForward;
+ USHORT nPos = bForward ? 0 : rTxtNd.GetSwpHints().Count();
+ xub_StrLen nCntntPos = rPam.GetPoint()->nContent.GetIndex();
+
+ while( 0 != ( pTxtHt=(*fnMove->fnGetHint)(rTxtNd.GetSwpHints(),nPos,nCntntPos)))
+ if( pTxtHt->Which() == rCmpItem.Which() &&
+ ( !bValue || CmpAttr( pTxtHt->GetAttr(), rCmpItem )))
+ {
+ lcl_SetAttrPam( rPam, *pTxtHt->GetStart(), pTxtHt->GetEnd(), bForward );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+//------------------ Suche nach mehren Text Attributen -------------------
+
+struct _SwSrchChrAttr
+{
+ USHORT nWhich;
+ xub_StrLen nStt, nEnd;
+
+ _SwSrchChrAttr( const SfxPoolItem& rItem,
+ xub_StrLen nStart, xub_StrLen nAnyEnd )
+ : nWhich( rItem.Which() ), nStt( nStart ), nEnd( nAnyEnd )
+ {}
+};
+
+class SwAttrCheckArr
+{
+ _SwSrchChrAttr *pFndArr, *pStackArr;
+ xub_StrLen nNdStt, nNdEnd;
+ USHORT nArrStart, nArrLen;
+ USHORT nFound, nStackCnt;
+ SfxItemSet aCmpSet;
+ BOOL bNoColls;
+ BOOL bForward;
+
+public:
+ SwAttrCheckArr( const SfxItemSet& rSet, int bForward, int bNoCollections );
+ ~SwAttrCheckArr();
+
+ void SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam );
+
+ // wieviele Attribute ueberhaupt ??
+ USHORT Count() const { return aCmpSet.Count(); }
+ int Found() const { return nFound == aCmpSet.Count(); }
+ int CheckStack();
+
+ xub_StrLen Start() const;
+ xub_StrLen End() const;
+
+ xub_StrLen GetNdStt() const { return nNdStt; }
+ xub_StrLen GetNdEnd() const { return nNdEnd; }
+
+ int SetAttrFwd( const SwTxtAttr& rAttr );
+ int SetAttrBwd( const SwTxtAttr& rAttr );
+};
+
+
+
+SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, int bFwd,
+ int bNoCollections )
+ : aCmpSet( *rSet.GetPool(), RES_CHRATR_BEGIN, RES_TXTATR_END-1 )
+{
+ aCmpSet.Put( rSet, FALSE );
+ bNoColls = bNoCollections;
+
+ bForward = bFwd;
+
+ // Bestimmen den Bereich des Fnd/Stack-Arrays (Min/Max)
+ SfxItemIter aIter( aCmpSet );
+ nArrStart = aCmpSet.GetWhichByPos( aIter.GetFirstPos() );
+ nArrLen = aCmpSet.GetWhichByPos( aIter.GetLastPos() ) - nArrStart+1;
+
+ pFndArr = (_SwSrchChrAttr*)new char[ nArrLen * sizeof(_SwSrchChrAttr) ];
+ pStackArr = (_SwSrchChrAttr*)new char[ nArrLen * sizeof(_SwSrchChrAttr) ];
+}
+
+
+SwAttrCheckArr::~SwAttrCheckArr()
+{
+ delete (void*) pFndArr;
+ delete (void*) pStackArr;
+}
+
+
+
+#pragma optimize( "e", off )
+
+void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam )
+{
+ memset( pFndArr, 0, nArrLen * sizeof(_SwSrchChrAttr) );
+ memset( pStackArr, 0, nArrLen * sizeof(_SwSrchChrAttr) );
+ nFound = 0;
+ nStackCnt = 0;
+
+ if( bForward )
+ {
+ nNdStt = rPam.GetPoint()->nContent.GetIndex();
+ nNdEnd = rPam.GetPoint()->nNode == rPam.GetMark()->nNode
+ ? rPam.GetMark()->nContent.GetIndex()
+ : rTxtNd.GetTxt().Len();
+ }
+ else
+ {
+ nNdEnd = rPam.GetPoint()->nContent.GetIndex();
+ nNdStt = rPam.GetPoint()->nNode == rPam.GetMark()->nNode
+ ? rPam.GetMark()->nContent.GetIndex()
+ : 0;
+ }
+
+ if( bNoColls && !rTxtNd.GetpSwAttrSet() )
+ return ;
+
+ const SfxItemSet& rSet = rTxtNd.GetSwAttrSet();
+// if( !rSet.Count() )
+// return;
+
+ SfxItemIter aIter( aCmpSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ const SfxPoolItem* pFndItem;
+ USHORT nWhich;
+
+ while( TRUE )
+ {
+ // nur testen, ob vorhanden ist ?
+ if( IsInvalidItem( pItem ) )
+ {
+ nWhich = aCmpSet.GetWhichByPos( aIter.GetCurPos() );
+ if( RES_TXTATR_END <= nWhich )
+ break; // Ende der TextAttribute
+
+ if( SFX_ITEM_SET == rSet.GetItemState( nWhich, !bNoColls, &pFndItem )
+ && !CmpAttr( *pFndItem, rSet.GetPool()->GetDefaultItem( nWhich ) ))
+ {
+ pFndArr[ nWhich - nArrStart ] =
+ _SwSrchChrAttr( *pFndItem, nNdStt, nNdEnd );
+ nFound++;
+ }
+ }
+ else
+ {
+ if( RES_TXTATR_END <= (nWhich = pItem->Which() ))
+ break; // Ende der TextAttribute
+
+//JP 27.02.95: wenn nach defaults gesucht wird, dann muss man bis zum Pool
+// runter
+// if( SFX_ITEM_SET == rSet.GetItemState( nWhich, !bNoColls, &pFndItem )
+// && *pFndItem == *pItem )
+ if( CmpAttr( rSet.Get( nWhich, !bNoColls ), *pItem ) )
+ {
+ pFndArr[ nWhich - nArrStart ] =
+ _SwSrchChrAttr( *pItem, nNdStt, nNdEnd );
+ nFound++;
+ }
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+}
+#pragma optimize( "", on )
+
+
+int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr )
+{
+ _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() );
+ // alle die nicht im Bereich sind -> ignorieren
+ if( aTmp.nEnd <= nNdStt || aTmp.nStt >= nNdEnd )
+ return Found();
+
+ const SfxPoolItem* pItem;
+
+// --------------------------------------------------------------
+// Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht
+// --------------------------------------------------------------
+ USHORT nWhch = rAttr.Which();
+ SfxWhichIter* pIter = NULL;
+ const SfxPoolItem* pTmpItem;
+ const SwAttrSet* pSet;
+ if( RES_TXTATR_CHARFMT == nWhch )
+ {
+ if( bNoColls )
+ return Found();
+ SwCharFmt* pFmt = rAttr.GetCharFmt().GetCharFmt();
+ if( pFmt )
+ {
+ pSet = &pFmt->GetAttrSet();
+ pIter = new SfxWhichIter( *pSet );
+ nWhch = pIter->FirstWhich();
+ while( nWhch &&
+ SFX_ITEM_SET != pSet->GetItemState( nWhch, TRUE, &pTmpItem ) )
+ nWhch = pIter->NextWhich();
+ if( !nWhch )
+ pTmpItem = NULL;
+ }
+ else
+ pTmpItem = NULL;
+ }
+ else
+ pTmpItem = &rAttr.GetAttr();
+ while( pTmpItem )
+ {
+ SfxItemState eState = aCmpSet.GetItemState( nWhch, FALSE, &pItem );
+ if( SFX_ITEM_DONTCARE == eState || SFX_ITEM_SET == eState )
+ {
+ register USHORT n;
+ _SwSrchChrAttr* pCmp;
+
+ // loesche erstmal alle, die bis zu der Start Position schon wieder
+ // ungueltig sind:
+
+ _SwSrchChrAttr* pArrPtr;
+ if( nFound )
+ for( pArrPtr = pFndArr, n = 0; n < nArrLen;
+ ++n, ++pArrPtr )
+ if( pArrPtr->nWhich && pArrPtr->nEnd <= aTmp.nStt )
+ {
+ pArrPtr->nWhich = 0; // geloescht
+ nFound--;
+ }
+
+ // loesche erstmal alle, die bis zu der Start Position schon wieder
+ // ungueltig sind. Und verschiebe alle die "offen" sind, heisst ueber
+ // die Start Position ragen, vom Stack in den FndSet
+
+ if( nStackCnt )
+ for( pArrPtr = pStackArr, n=0; n < nArrLen; ++n, ++pArrPtr )
+ {
+ if( !p